+ 1
When i am using break statement in if loop , an error occurs stating that break statement is outside the loop!! Please help!
6 ответов
+ 1
An if statement is no loop, so if you just wrote "break" inside an if statement, it is not inside a loop. Use while or for loops instead.
+ 8
As others indicated -- without seeing it will be hard to determine what the problem is, exactly. Perhaps it's a problem of proper indentation? If you have an indented block of code, the break command should usually be indented at least a level deeper.
+ 4
Can I see your code?
+ 2
Not without seeing the code.
+ 1
thanks for your reply guys!
I got it right!
what Moritz said was the problem in my code! I used if statement and it was not inside of for or while loop!..
0
Moritz raises a good point.