DEV Community

loading...

Discussion on: FizzBuzz challenge in as many languages as possible

Collapse
believer profile image
Rickard Natt och Dag

Language: ReasonML
Sketch: sketch.sh/s/XABe2ghxBqncDWTTKpNK8n/

module FizzBuzz = {
  let get =
    fun
    | (0, 0, _) => "FizzBuzz"
    | (0, _, _) => "Fizz"
    | (_, 0, _) => "Buzz"
    | (_, _, value) => string_of_int(value);
};

for (index in 1 to 100) {
  print_endline(FizzBuzz.get((index mod 3, index mod 5, index)));
};