let fizzbuzz n =
let rec loop i max div3 div5 =
if i < max then
match i = div3, i = div5 with
| true, true -> print_endline "FizzBuzz"; loop (i + 1) max (div3 + 3) (div5 + 5)
| true, false -> print_endline "Fizz"; loop (i + 1) max (div3 + 3) div5
| false, true -> print_endline "Buzz"; loop (i + 1) max div3 (div5 + 5)
| false, false -> print_endline (string_of_int i); loop (i + 1) max div3 div5
in
loop 1 n 3 5
let _ = fizzbuzz 100
Game Developer, Metaverse Creater.
With over four years of experience working in the metaverse, Theo's had the opportunity to work on top experiences, spearheading technical and creative design.
Game Developer, Metaverse Creater.
With over four years of experience working in the metaverse, Theo's had the opportunity to work on top experiences, spearheading technical and creative design.
Language: OCaml
Code:
Interesting! What kind of work is OCaml used for? 😊
Compilers, Proof Assistants, Static Verification Tools. Facebook uses it a lot under the hood.
Interesting.
Welcome to dev.to btw (saw you joined today).