Exception handling syntax: Difference between revisions

Content deleted Content added
[[Python (programming language)|Python]]: <source> … not sure if the leading space is vital here
Line 201:
 
===[[Objective Caml|OCaml]]===
<source lang=ocaml>
exception MyException of string * int (* exceptions can carry a value *)
let _ =
try
raise (MyException ("not enough food", 2));
print_endline "Not reached"
with
| MyException (s, i) ->
| MyException (s, i) ->
Printf.printf "MyException: %s, %d\n" s i
| _ -> (* catch all exceptions *)
print_endline "Unexpected exception"
</source>
 
===[[C programming language|C]]===