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."}

January 10, 2007. Rails. 1 Comment.

One Comment

  1. labrat replied:

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

    as well.

    January 10th, 2007 at 5:38 am. Permalink.

Leave a Reply

Trackback URI