Sign in to follow this  
X Jado X

[Python] elif & else

Recommended Posts

Quote:
Original post by bakery2k1
Quote:
Original post by X Jado X
>>> if 9 == 9:
do_stuff()
elif that:

SyntaxError: invalid syntax


Elif is higlighted.


The "elif" needs to be indented to the same level as the "if".

Yeah that's one of the things that first aggravated me when I first learned Python never mind not using elseif like 99% of the other languages!
Since whitespace matters also unlike 99% of other languages a good Python editor is essential since I used the one that came with Python and it never alerted me to silly mistakes like this.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this