Example for the try_catchstatic void Try_catch_sample(Args _args){int d, a; Exception ArithmeticException;try{ // monitor a block of code. info(strFmt("Try Block execution")); d = 0; a = 42 / d; info(strFmt("This will not be printed.")); } catch (ArithmeticException ) { info(strFmt("Division by zero.")); } info(strFmt("After catch statement.")); }
Example for the try_catch
ReplyDeletestatic void Try_catch_sample(Args _args)
{
int d, a;
Exception ArithmeticException;
try
{ // monitor a block of code.
info(strFmt("Try Block execution"));
d = 0;
a = 42 / d;
info(strFmt("This will not be printed."));
}
catch (ArithmeticException )
{
info(strFmt("Division by zero."));
}
info(strFmt("After catch statement."));
}