2 ms·
The rust version with wildcards looks very similar. Neat. https://play.rust-lang.org/?gist=69e15f3bf9a18359de10e657c4fda77f https://play.rust-lang.org/?gist=69e
by infogulch 8y ago
The rust version with wildcards looks very similar. Neat. https://play.rust-lang.org/?gist=69e15f3bf9a18359de10e657c4fda77f https://play.rust-lang.org/?gist=69e15f3bf9a18359de10e657c4f...
- texuf 8y agoSame thing in swift: https://iswift.org/playground?fOI8XQ&v=3 https://iswift.org/playground?fOI8XQ&v=3 for i in 0...100 { switch (i % 3, i % 5) { case (0, 0): print("FizzBuzz") case (0, _): print("Fizz") case (_, 0): print("Buzz") case (_, _): print("\(i)") } }
- pdimitar 8y agoElixir: def fizzbuzz(x) when is_integer(x) do case {rem(x, 3), rem(x, 5)} do {0, 0} -> "FizzBuzz" {0, _} -> "Fizz" {_, 0} -> "Buzz" {_, _} -> Integer.to_string(x) end end
- deleted 8y ago[deleted]