Skip to content

Instantly share code, notes, and snippets.

@banister
Created January 19, 2012 03:42
Show Gist options
  • Save banister/c424718ac0e04724bda0 to your computer and use it in GitHub Desktop.
Save banister/c424718ac0e04724bda0 to your computer and use it in GitHub Desktop.
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