I don't understand why I'm having an error with Python when I use a single-line if
statement after a semicolon (used as separator).
This is ok:
if True: print("it works")
#### it works
But this gives a syntax error:
a=1; if True: print("it should work?")
#### SyntaxError: invalid syntax
I use Python3, with Spyder.
Thanks for any explanation!
Aucun commentaire:
Enregistrer un commentaire