Created
May 25, 2017 09:24
-
-
Save mingrammer/205e9bd45a5b1d6dca026ffc3e4abb06 to your computer and use it in GitHub Desktop.
Two styles of writing 'if' statement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### without elif, else | |
if cond == 'one': | |
# something | |
return # or break | |
if cond == 'two': | |
# something | |
return # or break | |
# something | |
return # or break | |
### use elif, else | |
if cond == 'one': | |
# something | |
elif cond == 'two': | |
# something | |
else: | |
# something | |
return # or break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment