aboutsummaryrefslogtreecommitdiff
path: root/Examples/ocaml/contract/runme.ml
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/ocaml/contract/runme.ml')
-rw-r--r--Examples/ocaml/contract/runme.ml12
1 files changed, 12 insertions, 0 deletions
diff --git a/Examples/ocaml/contract/runme.ml b/Examples/ocaml/contract/runme.ml
new file mode 100644
index 000000000..a77eed701
--- /dev/null
+++ b/Examples/ocaml/contract/runme.ml
@@ -0,0 +1,12 @@
+open Swig
+open Example
+
+let _ = print_endline "This won't throw."
+let _ = Printf.printf "Cos 1.0 is %f\n" (_cos '(1.0) as float)
+let _ = print_endline "This will throw."
+let _ =
+ try
+ Printf.printf "Cos 5.0 is %f\n" (_cos '(5.0) as float)
+ with Failure s ->
+ print_endline s ;
+ print_endline "Exception thrown."