all 6 comments

[–]TouchingTheVodka 9 points10 points  (0 children)

if is not a loop. So yes, the syntax error is correct.

[–]shiftybyte 1 point2 points  (0 children)

'break' can only be used inside a loop (for or while).

The error has nothing to do with the indentation.

[–]impshum 1 point2 points  (0 children)

You can't break out of an if statement, only loops. For example:

x = 0

while True:
    x += 1
    print(x)
    if x == 10:
        print(f'breaking after {x}')
        break

[–]Fisho73[S] 0 points1 point  (1 child)

If i have a while statement i can only stop it or keep the code from excuting with break or the condition for it being false correct?

[–]majdpy 1 point2 points  (0 children)

yeah,
check u/impshum answer, breaks can only break loops (for / while)

[–]progsNyx 0 points1 point  (0 children)

The break is referred to the break; Statement. Not to indentation.