Someone sent me this FoxTrot cartoon that compares how to write 500 times “I will not throw paper airplanes in class.”
They didn’t have any Ruby in there, so I thought I’d share…
# Simplest and my favorite.
500.times {puts "I will not throw paper airplanes in class."}
# Uses range, but ignores the block parameter.
(1..500).each {|n| puts "I will not throw paper airplanes in class."}
# Fancy:
(1..500).each {|n| puts "I will not throw paper airplanes in class for the #{n}th time."}
The second could be:
(1..500).each {puts “I will not throw paper airplanes in class.”}
as well.