When can we use break with if and how to use break in for loops | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

When can we use break with if and how to use break in for loops

Break with if

17th Jun 2019, 3:26 PM
Gandalf99
Gandalf99 - avatar
3 Answers
+ 2
when a for loop encounters the break keyword, it will break out of the loop. With an if statement, it will obviously break when a specific condition is true
17th Jun 2019, 3:58 PM
Airree
Airree - avatar
+ 1
Airree i've been trying to use break with if condition but it's causing an error always,can you show me an example on how to use break with for loop
18th Jun 2019, 5:04 AM
Gandalf99
Gandalf99 - avatar
0
Any help would be appreciated
19th Jun 2019, 11:52 AM
Gandalf99
Gandalf99 - avatar