loops Statements in Ruby on Rails

while loop:

A while block denotes a section of code that is to be repeated over and over while the expression x < 100 is satisfied. Therefore, x is doubled loop after loop and printed to the screen. Once x is 100 or over, the loop ends. Until provides the opposite functionality, looping until a certain condition is met:

x = 1
while x < 100
puts x
x = x * 2
end

until loop:

until allows you to loop code based on the result of a comparison made on each loop. until provides the opposite functionality, looping until a certain condition is met:

x = 1
until x > 99
puts x
x = x * 2
end