Last active
October 27, 2017 10:40
-
-
Save everm1nd/78d353dff1ad6fe8c210ad9899352da9 to your computer and use it in GitHub Desktop.
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
# this works, because `proc === x` is same as `proc.call(x)` | |
# weird syntactic choice makes a great job in case statements | |
def say_something_about(number) | |
greater_then_10 = -> (number) { number > 10 } | |
equals_15 = -> (number) { number === 15 } | |
case number | |
when greater_then_10 | |
puts "it's greater then 10!" | |
when equals_15 | |
puts "it equals 15!" | |
else | |
puts "it's #{number}" | |
end | |
end | |
say_something_about 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment