How to fix while loop infiniti? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
2nd Jun 2020, 2:19 PM
Aminul
Aminul - avatar
5 Answers
+ 1
Your welcome
2nd Jun 2020, 2:52 PM
Ambele Newton
Ambele Newton - avatar
0
Create a boolean variable and replace it with the 1 in the while loop's param. Then change it to false in the loop with a certain condition
2nd Jun 2020, 2:34 PM
Ambele Newton
Ambele Newton - avatar
0
Please give me an example...
2nd Jun 2020, 2:48 PM
Aminul
Aminul - avatar
0
bool cond = true; while (cond){ //do stuff // cond = false to break the loop }
2nd Jun 2020, 2:51 PM
Ambele Newton
Ambele Newton - avatar
0
Thanks...
2nd Jun 2020, 2:51 PM
Aminul
Aminul - avatar