Exceptions: Difference between revisions

UCB Logo
(Ada section is extended)
(UCB Logo)
Line 304:
eventSetup = true;
}
 
=={{header|Logo}}==
{{works with|UCB Logo}}
to div.checked :a :b
if :b = 0 [(throw "divzero 0)]
output :a / :b
end
to div.safely :a :b
output catch "divzero [div.checked :a :b]
end
There are also some predefined exceptions:
* '''throw "toplevel''' returns to the interactive prompt if uncaught (like control-C)
* '''(throw "error [message])''' prints a message like a primitive, bypassing normal catch output
* '''throw "system''' immediately exits Logo to the shell
* '''catch "error''' will catch any thrown error instead of printing an error message
 
=={{header|OCaml}}==
Anonymous user