Skip to content

Instantly share code, notes, and snippets.

@antonkartashov
Last active August 29, 2015 14:26
Show Gist options
  • Save antonkartashov/97cbfea129e6396b1245 to your computer and use it in GitHub Desktop.
Save antonkartashov/97cbfea129e6396b1245 to your computer and use it in GitHub Desktop.
# 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