Last active
August 29, 2015 14:26
-
-
Save antonkartashov/97cbfea129e6396b1245 to your computer and use it in GitHub Desktop.
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
# In conditional statements you can put the expression first | |
print "Game Over" if lives is 0 | |
# The inverse of "if" is aliased to "unless" | |
power = on unless lives is 0 | |
# Here's the English-language equivalents of logic operators !, &&, and ||: | |
drawGlow() if (not standing and energy > 10) or poweredUp | |
# The inverse form for simple expressions: | |
print "Go!" for [1..3] | |
# These all can be used for prose-like readability: | |
animatePlayer() while alive | |
fall() until yPosition is 0 | |
loop | |
killBaddie() | |
break if baddieCount is 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment