
// Script function: This script divides two numbers, but will not allow a division by zero.

// Unless named starting with GlobalSino, EM, My, Self, the function commands are defined 
//by Gatan DM, please see at link: http://www.globalsino.com/EM/page2597.html


number div_zero()
{
return 0 // the result returns to 0 if the denominator is 0.
}

number i, j, EMresult;
GetNumber("Enter a number for i", 1967, i) // numerator
GetNumber("Enter a number for j", 0, j) // denominator

EMresult = j ? i/j : div_zero() // // This statement prevents a divide-by-zero error.
result ("Result: " + EMresult + "\n")
