Different ways to write “I will not throw paper airplanes in class.” 500 times in Ruby

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."}
This entry was posted in Rails. Bookmark the permalink.

One Response to Different ways to write “I will not throw paper airplanes in class.” 500 times in Ruby

  1. labrat says:

    The second could be:
    (1..500).each {puts “I will not throw paper airplanes in class.”}

    as well.