|
|
|
|
|
by jpatokal
2710 days ago
|
|
I'm curious: do you genuinely find that beautiful?To me all the enumerable/map/frozen string literal stuff seems pointlessly overcomplicated compared to the simplicity of just writing down what you're supposed to do: (1..100).each do |n|
a = String.new
a << "Fizz" if n%3 == 0
a << "Buzz" if n%5 == 0
a << n.to_s if a.empty?
puts a
end
(Disclaimer: not my code, on mobile so I stole that off GitHub) |
|
I changed it to a relatively KISS and IMO genuinely beautiful version in the parent, for others' benefits here's the version you were referring to in the above comment: