0

While loop

When does an infinite loop occur in while loop?

29th May 2018, 10:19 PM
ADESH RAI
ADESH RAI - avatar
1 Answer
+ 6
Basically an infinite loop occurs when the condition tested for in the while is always true. Let's look at Jay's examples: true is always true so your loop goes on forever x = 0 and never gets changed so the condition x < 10 is always true so again, your loop goes on forever
29th May 2018, 10:35 PM
cyk
cyk - avatar