Python Error: SyntaxError: ‘break‘ outside loop

report errors:

SyntaxError: 'break' outside loop

Break can only be used in a while loop or a for loop. If it is used in an if conditional statement, an error will be reported: syntax error: ‘break’ outside loop. However, if the if conditional statement is nested inside a while loop or a for loop,
if you do not pay attention to the format when corresponding to while, an error will also be reported

Read More: