<< Prev | - Up - | Next >> |
We now illustrate how to quit a recusive call by throwing and catching an exception. The example is a simple recursion that increments a counter but quits the recursion once it gets equal to 10000
.
declare proc{Process N}
if N==10000
then raise 'error in Process' end
else {Process N+1}
end
end
try
{Process 0}
catch Exception then
{Browse Exception}
end
<< Prev | - Up - | Next >> |