why do I get syntax error on if <code>: break

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu May 24 22:27:25 EDT 2018


On 2018年5月24日 19:12:33 -0700, asa32sd23 wrote:
> here is the code, i keep getting an error, "break outside loop". if it
> is false just exit function

break doesn't exit the function, it exits the loop. There is no loop to 
exit, so it is an error.
Believe the compiler when it tells you there is a syntax error with your 
code. The compiler is always correct.
-- 
Steve


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /