Break statement

If we are in a nested for loop and we use break in the inner for loop, then will it come out of all the loops or just the inner one?

@tanyaa.sood you will come out of the inner loop only

How to come out of all the loops then?

@tanyaa.sood you can use a β€œflag” variable and put it as a condition in the outer loop. change its value inside the condition before you use the break statement.