+ 1
How can we make a loop an infinite loop?
4 Answers
+ 1
while(true){}
+ 7
using for loop : for(;;){}
using while loop : while(1){}
using do while loop : do{}while(1)
+ 2
the easiest method is this:
for(; ;){}
+ 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