ADVERTISEMENT
ADVERTISEMENT

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

Ruby Example: Write a program to create an infinite loop using "until" loop.
Submitted by Nidhi, on December 20, 2021

Problem Solution:

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

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.

Ruby Looping Programs »


ADVERTISEMENT
ADVERTISEMENT


Comments and Discussions!



ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.