Ruby Language Control Flow while, until

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

A while loop executes the block while the given condition is met:

i = 0
while i < 5
  puts "Iteration ##{i}"
  i +=1
end

An until loop executes the block while the conditional is false:

i = 0
until i == 5
  puts "Iteration ##{i}"
  i +=1
end


Got any Ruby Language Question?