1 min read

Ruby's Looping Suffixes

One-line looping in Ruby
Ruby's Looping Suffixes
Photo by Önder Örtel / Unsplash

One-line looping in Ruby.

Filed under stuff-I-should-have-known. You can have one liner looping constructs in Ruby

x = 0
x += 1 while x < 5

or

x = 0
x += 1 until x == 5