Last active
August 29, 2015 14:26
-
-
Save antonkartashov/ec3bd4cc23684cf4aedc 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
# Можно ставить условие после выражения: | |
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