Exceptions/Catch an exception thrown in a nested call: Difference between revisions

fix code and add output
(fix code and add output)
Line 2,098:
 
=={{header|Maple}}==
<lang Maple>baz := proc( which )
{{incomplete|Maple|"Show/describe what happens when the program is run."}}
if ( which = 0 ) then
<lang Maple>num_times:=0:
error "U0";
baz := proc()
else
global num_times := num_times + 1;
error `if`(num_times <= 1, "U0",error "U1");
end;
end proc:
 
bar := proc( which )
baz( which );
end proc;:
 
foo := proc()
local i;
for i from 0 to 1 do
bar();try
bar(i);
catch "U0":
end;
end do;
end proc;</lang>:
 
foo();</lang>
{{out}}
<lang Maple>Error, (in baz) U1</lang>
 
=={{header|Mathematica}} / {{header|Wolfram Language}}==
Anonymous user