Ruby While loop



Ruby while loop is similar in syntax with other interpreted scripting languages.

Ruby While Loop Syntax

while cond
   code to be executed
end

Ruby While Loop Example

ruby_variable = 0
while ruby_variable < 10
   ruby_variable++;
   puts ruby_variable
end