Advertisement
ericjmorey

Untitled

Nov 13th, 2019
1,130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.37 KB | None | 0 0
  1. # let x = ref 42;;
  2. val x : int ref = {contents = 42}
  3. # x := 100/4;;
  4. - : unit = ()
  5. # let y = !x + 1;;
  6. val y : int = 26
  7. # print_int 3;;
  8. - : unit = <unknown constructor>
  9. # print_string "Hello";;
  10. - : unit = <unknown constructor>
  11. # print_string "x = ";
  12. # print_int !x;
  13. # print_newline ();;
  14. - : unit = ()
  15. # Printf.printf "x = %d. Bye %s\n" !x "John";;
  16. - : unit = ()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement