Skip to content

Instantly share code, notes, and snippets.

@featherart
Last active December 23, 2015 18:49
Show Gist options
  • Save featherart/6678157 to your computer and use it in GitHub Desktop.
Save featherart/6678157 to your computer and use it in GitHub Desktop.
conditionals lab
# in irb, evaluate the following:
4 < 5
4 == 5 # note the == is different from =
4 != 5
1 <= 2
0 > 1
1 > 1
1 >= 1
blue = true
red = false
blue || red
blue && blue
red && red
red && blue
red || blue || (4 == 5)
blue && (1 >= 1) && (9 != 10)
# If all that was too easy, please try this:
# Suddenly you find yourself in the negative utopia
# that is 1984! Write a code snippet to give a result if
# 2 + 2 == 5 and another result if that does not evaluate to true
if # your code here
else
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment