-
-
Save banister/c424718ac0e04724bda0 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
switch(1) { | |
case_(0) { | |
puts "this wont be matched!" | |
} | |
case_(1) { | |
puts "matched!" | |
} | |
case_(2) { | |
puts "fall through!" | |
} | |
case_(3) { | |
puts "more fall through!" | |
puts "whee!" | |
} | |
case_(4) { | |
puts "no more fall through!" | |
breakout | |
} | |
case_(5) { | |
puts "this wont be printed :(" | |
} | |
default { | |
puts "this is matched if nothing else is" | |
} | |
} | |
# => nil | |
# OUTPUT | |
matched! | |
fall through! | |
more fall through! | |
whee! | |
no more fall through! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment