How to put the if condition into a loop statement | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to put the if condition into a loop statement

8th Jan 2017, 7:48 AM
Ameer shah
2 Answers
+ 3
You can add condition inside a loop, with or without suppress the condition into the parenthesis of the loop statement. You need to manage yourself the exit of the loop, inside a branch of a if statement, with 'break' keyword ( I guess that no condition in 'for' statement parethesis is evaluated to true, else, you can set 'true' instead of nothing to obtain an infinite loop )...
8th Jan 2017, 8:15 AM
visph
visph - avatar
- 1
;)
9th Jan 2017, 3:16 AM
Vu3sz
Vu3sz - avatar