gabriel wambua5,058 Points
Hi this is a question with regards to loops specifically while loops
Hi this is a question with regards to loops. I just realized that if I forget to do a ++ incremental in a while loop it will go on forever during run time.
My question is why is the incremental bit important?
Steven Parker201,931 Points
The loop runs until the condition being tested in the "while" becomes false. If nothing inside the loop changes the condition, it will never stop.
I assume the increment you refer to was being applied to a variable that is being tested in the "while" expression.