/tags/rel-1-3-15/SWIG/Examples/ocaml/simple/example_prog.ml

# · OCaml · 30 lines · 8 code · 16 blank · 6 comment · 0 complexity · dd5577cc262cc2cdd4b349b06dbaf35b MD5 · raw file

  1. (* example_prog.ml *)
  2. open Example
  3. (* Call our gcd() function *)
  4. let x = 42
  5. let y = 105
  6. let g = gcd x y
  7. let _ = Printf.printf "The gcd of %d and %d is %d\n" x y g
  8. (* Manipulate the Foo global variable *)
  9. (* Output its current value *)
  10. let _ = Printf.printf "Foo = %f\n" (_Foo_get ())
  11. (* Change its value *)
  12. let _ = _Foo_set 3.1415926
  13. (* See if the change took effect *)
  14. let _ = Printf.printf "Foo = %f\n" (_Foo_get ())