Skip to content

Instantly share code, notes, and snippets.

@antonkartashov
Last active August 29, 2015 14:26
Show Gist options
  • Save antonkartashov/ec3bd4cc23684cf4aedc to your computer and use it in GitHub Desktop.
Save antonkartashov/ec3bd4cc23684cf4aedc to your computer and use it in GitHub Desktop.
# Можно ставить условие после выражения:
print "Game Over" if lives is 0
# Для инверсии if есть отдельный оператор unless:
power = on unless lives is 0
# Логические операторы "не", "и" и "или" можно писать словами:
if (not standing and energy > 10) or powered
print "Grow"
# Простые циклы можно писать задом наперед:
print "Go!" for [1..3]
# Код читается как повесть:
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