// Demonstrate try/catch and loop termination and local variable combos
proc foo(a,b)
{
var x = "Error: ";
for (var i = -1; i <= 1; i++) {
try {
if (i == a) {
continue;
}
else if (i == b) {
return b;
}
var j = 1 / i;
"1/", i, " = ", j, '\n';
}
catch (e) {
"", x, e, '\n';
break;
}
}
return nil;
}
proc main()
{
"foo(0,0): ", foo(0,0), '\n';
"foo(0,1): ", foo(0,1), '\n';
"foo(100,100): ", foo(100,100), '\n';
}