// Script function: Demo of alloc, class and passing Objects to Functions with 
// "Exception Handling: Try, Catch and Throw."

// 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

class GlobalSino: object
{

void out_i(object GlobalSino, number i)
{
result ("Start\n")

try 
{ 
result ("Inside try block\n")
result ("Try second\n")
if(i==1) throw ("99") 
if(i==100) throw ("100") 
result ("This will not execute\n")
}

catch 
{
result ("Caught an exception value is: 99\n")
result ("End of catch")
}

result ("The end")

}
}

object EMObjectH = alloc (GlobalSino)
EMObjectH.out_i(100)



