Jump to content
  • Advertisement
Sign in to follow this  
X Jado X

[Python] elif & else

This topic is 3798 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
Show an example of code that gives that problem. Make sure to use [code] or [source] tags to ensure that the spacing shows up properly.

Share this post


Link to post
Share on other sites
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".

Share this post


Link to post
Share on other sites
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!