ptrelford

FizzBuzz in OCaml / F# style

Sep 7th, 2015
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.21 KB | None | 0 0
  1. let (|>) x f = f x
  2. in
  3. for i = 1 to 100 do (
  4.     match i mod 3, i mod 5 with
  5.     | 0, 0 -> "FizzBuzz"
  6.     | 0, _ -> "Fizz"
  7.     | _, 0 -> "Buzz"
  8.     | _, _ -> string_of_int i
  9. ) |> Printf.printf "%s\n"
  10. done
Advertisement
Add Comment
Please, Sign In to add comment