Last active
April 26, 2016 20:55
-
-
Save masterT/fc4a35ddbd412ab5f594b716afe74c70 to your computer and use it in GitHub Desktop.
Ocaml Examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let f ?(x = Some("valeur par default")) () = | |
match x with | |
| Some (y) -> print_string y | |
| None -> print_string "None" | |
;; | |
(* val f : ?x:string option -> unit -> unit = <fun> *) | |
f ();; | |
(* valeur par default- : unit = () *) | |
f ~x:None ();; | |
(* None- : unit = () *) | |
f ~x:(Some "ma valeur") ();; | |
(* ma valeur- : unit = () *) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment