Ruby Quicktips Logo

Ruby Quicktips

Random Ruby and Rails tips.
This blog is dedicated to deliver short, interesting and practical tidbits of the Ruby language and Ruby on Rails framework. Read more...

Your submissions are more than welcome!
Sep 14 ’11

Inline While and Until

Similar to if and unless, while and until can be used inline, too:

round = 0
puts round += 1 until round > 9

round = 0
puts round += 1 while round < 10

(Source: rubyloveinfo)

10 notes 0 comments (via rubyloveinfo)

  1. rubyquicktips reblogged this from rubyloveinfo
  2. rubyloveinfo posted this

Comments

You can use HTML tags for formatting. Wrap code in <code> tags and multiple lines of code in <pre><code> tags.

blog comments powered by Disqus