0
'break' outside loop (SyntaxError) on my first calculator code
https://code.sololearn.com/c8oTUYdJYibM/#py I don't what i do wrong with the 7th line. I just press 'enter' to go to the next line and type break and when i execute the code, it failed. But if i changed it to for example print('NO'), it's working! Please enlighten me THX
3 Answers
+ 8
It's because there is no loop to be broken there. Use exit() instead :)
+ 2
M.O.HONOR
break - keyword works only for breaking out of the loops like for and while .
To quit of if block use exit() function which terminates program execution
0
Thx a lot both of u :)