Created
August 23, 2011 05:16
-
-
Save dmonopoly/1164395 to your computer and use it in GitHub Desktop.
nil and false notion...
This file contains 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 mealtimes(meal) | |
arr = [meal.breakfast, meal.lunch, meal.dinner] | |
if arr == [true, true, true] | |
"breakfast, lunch, and dinner" | |
elsif arr == [false, false, false] | |
"" | |
elsif arr == [true, true, false] | |
"breakfast and lunch" | |
elsif arr == [true, false, true] | |
"breakfast and dinner" | |
elsif arr == [false, true, true] | |
"lunch and dinner" | |
elsif arr == [true, false, false] | |
"breakfast" | |
elsif arr == [false, true, false] | |
"lunch" | |
elsif arr == [false, false, true] | |
"dinner" | |
else | |
"ERROR" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment