Created
February 27, 2009 11:43
-
-
Save capotej/71424 to your computer and use it in GitHub Desktop.
using symbols as case conditions looks cool
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 choose arg | |
case arg | |
when :something: | |
puts "something" | |
when :other: | |
puts "other" | |
default | |
puts "nothing" | |
end | |
end | |
choose :something #=> "something" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment