+ 1

How can we make a loop an infinite loop?

9th Dec 2017, 4:21 PM
Shubham Kumar
Shubham Kumar - avatar
4 Answers
+ 1
while(true){}
10th Dec 2017, 2:27 AM
Shubham Kumar
Shubham Kumar - avatar
+ 7
using for loop : for(;;){} using while loop : while(1){} using do while loop : do{}while(1)
9th Dec 2017, 4:34 PM
Md. Nafis Ul Haque Shifat
Md. Nafis Ul Haque Shifat - avatar
+ 2
the easiest method is this: for(; ;){}
9th Dec 2017, 4:28 PM
Roabs
Roabs - avatar
+ 2
below 4 methods for ruby #method 1 limited by stack level def infini puts infini end #method 2 not limited by anything actually loop do puts 'infini start' sleep(9) puts "I'm refreshed let's do it again'" sleep(2) puts "short nap, \n restart" end #method 3 while loop while(!false) puts 'whi...' end #method 4 until loop until(false) puts 'til..' end
9th Dec 2017, 4:34 PM
Shubham Kumar
Shubham Kumar - avatar