PageRenderTime 39ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/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
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
  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 ())