Below you can see some examples for how to create some examples in OCaml. Try and figure out the outputs yourself but if you get stuck, check the screenshots!
(* Creating a variable *) let v = 1;; (* Adding two variables together *) v+v;; (* Variables within Variables - Inception.*) let v = 2 in v + v;; (* The above code does not change the value of v*) v + v;; (* More complicated examples of above *) let v = 1 in (let v = 5 in v * v) - (v * v);;
Screen Shot 2014-11-02 at 18.18.43.png 32.49KB 0 downloads