is we can write for(; ;); for any exceptional case? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

is we can write for(; ;); for any exceptional case?

31st Jul 2018, 2:12 PM
shrish suryvanshi
shrish suryvanshi - avatar
2 Answers
+ 3
What do you mean? for(; ;) is the same as while(true) it gives you an infinite loop. You can escape it by putting a break condition inside, like e.g. int i = 4; for(;;){ i++; if(i==10){ break; } }
31st Jul 2018, 2:27 PM
Matthias
Matthias - avatar
+ 1
thats what i want to know thanku very much...
31st Jul 2018, 5:08 PM
shrish suryvanshi
shrish suryvanshi - avatar