RosettaCodeData/Task/Pointers-and-references/OCaml/pointers-and-references.ocaml
Ingy döt Net b83f433714 tasks a-s
2013-04-10 23:57:08 -07:00

3 lines
219 B
Text

let p = ref 1;; (* create a new "reference" data structure with initial value 1 *)
let k = !p;; (* "dereference" the reference, returning the value inside *)
p := k + 1;; (* set the value inside to a new value *)