re: Ruby vs Elixir - FizzBuzz VIEW POST

FULL DISCUSSION
 

FWIW, code golf solution:

1.upto(31).map{|i|[i,"".tap{|s|s<<'Fizz'if(i%3).zero?;s<<'Buzz'if(i%5).zero?}]}
 
 

Equivalent-ish, Elixir code golf solution:

1..31|>Enum.map(fn n when rem(n,15)==0->"FizzBuzz";n when rem(n,3)==0->"Fizz";n when rem(n,5)==0->"Buzz";n->n end)|>IO.inspect
code of conduct - report abuse