Skip to content

Instantly share code, notes, and snippets.

@unnu
Created October 29, 2009 23:45
Show Gist options
  • Save unnu/221945 to your computer and use it in GitHub Desktop.
Save unnu/221945 to your computer and use it in GitHub Desktop.
IDEA 1
(1..100).each {|i| puts [i,('foo' if i%3==0),('bar' if i%5==0)].join}
IDEA 2
(1..100).each {|i| puts "#{i}#{'foo' if i%3==0}#{'bar' if i%5==0}"}
(1..100).each{|i|puts"#{i}#{'foo'if i%3==0}#{'bar'if i%5==0}"} #shortened
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment