wohhie
12/31/2016 - 10:41 PM

Unitl Loop and Untill Modifier -------------------------------------------- untill loop works like the while untill modifier works like the

Unitl Loop and Untill Modifier

untill loop works like the while untill modifier works like the do while loop

#UTILL loop do

=begin
    utill condition do
        CODES
    end
=end

$i = 0
$num = 5
until $i > $num do
    puts "INSIDE THE LOOP $i = #$i"
    $i += 1
end


#UTILL modifier Syntax
$j = 0
$reach = 0

begin
    puts "Inside the loop $i = #{$j}"
    $j += 1

end until $j > $reach
#alternative for loop

=begin 
    (RANGE).each do |VARIABLE_NAME|
        CODES
    end
=end

(0..5).each do |i|
    puts "Value is : #{i}"
end