2 ms·
as per Jpakotal's comment elsewhere this might be even prettier: 1..100 |> Enum.map_join("\n", fn int when rem(int, 15) == 0 -> "FizzBuzz"
by dnautics 8y ago
as per Jpakotal's comment elsewhere this might be even prettier:
1..100
|> Enum.map_join("\n", fn
int when rem(int, 15) == 0 -> "FizzBuzz"
int when rem(int, 5) == 0 -> "Fizz"
int when rem(int, 3) == 0 -> "Buzz"
int -> inspect int
end)
|> IO.puts