Created
July 12, 2014 20:36
-
-
Save alexandre/2f9f92199310d851844c to your computer and use it in GitHub Desktop.
exemplo de substituição de instruções de controle (if, else) por expressões booleanas.
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
| # Versão utilizando if/else | |
| if x == 10: | |
| fun_add(x) | |
| else: | |
| fun_del(x) | |
| # utilizando expressões booleanas apenas... | |
| (x == 10 and fun_add(x)) or (fun_del(x)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment