Created
August 20, 2012 13:28
-
-
Save zakki/3404032 to your computer and use it in GitHub Desktop.
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 window = Dom_html.window;; | |
| let foo i = | |
| let result = try Some (List.find (fun s -> s = i) [0; 1; 5]) with Not_found -> None in | |
| match result with | |
| Some(n) -> window##alert(Js.string (Printf.sprintf "foo Some(%d)" n)) | |
| | None -> window##alert(Js.string "foo None");; | |
| for i = 0 to 3 do | |
| foo i | |
| done;; | |
| for i = 0 to 3 do | |
| let result = try Some (List.find (fun s -> s = i) [0; 1; 5]) with Not_found -> None in | |
| match result with | |
| Some(n) -> window##alert(Js.string (Printf.sprintf "Some(%d)" n)) | |
| | None -> window##alert(Js.string "None") | |
| done;; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment