Q:

Ruby program to create an infinite loop using \'until\' loop

belongs to collection: Ruby Looping Programs

0

In this program, we will use the "until" loop to print the "Hello" message infinite times.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Program/Source Code:

The source code to create an infinite loop using the "until" loop is given below. The given program is compiled and executed successfully.

# Ruby program to create an infinite loop 
# using the "until" loop.

flag = false;

until flag==true
    puts "Hello";   
end

Output:

Hello
Hello
Hello
Hello
.
.

Infinite times

Explanation:

In the above program, we created a Boolean variable flag initialized with false. Then we printed the "Hello" message infinite times using the "until" loop.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Ruby program to demonstrate the nested \'unti... >>
<< Ruby program to print numbers from 1 to 5 using fo...