Created
May 18, 2011 14:54
-
-
Save tjmcewan/978734 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
def select_animal(num) | |
animal = case num | |
when (1 or 2) then :monkey # 2 & 4 never get reached | |
when (3 || 4) then :giraffe | |
end | |
return animal | |
end | |
(1..4).each do |n| | |
puts select_animal(n) | |
end | |
# Ruby 1.9.2 | |
# => monkey | |
# => | |
# => giraffe | |
# => |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment