diff options
Diffstat (limited to 'Switch/README.md')
| -rw-r--r-- | Switch/README.md | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/Switch/README.md b/Switch/README.md new file mode 100644 index 0000000..92be1f4 --- /dev/null +++ b/Switch/README.md @@ -0,0 +1,46 @@ +# Switch + +Limbo does not have a verbatim `switch` statement. Rather, it has a statement named `case` which is analogous, but not identical to C's switch-case construct. + +Limbo case statements break by default and accept range matching operations involving the `or` and `to` keywords. + +Note: A break or continue followed by a label causes a break out of, or the next iteration of, the enclosing construct that is labeled with the same label. + +## Source + +### switch.b:16,31 + + + +### switch.b:33,42 + + + +### switch.b:44,51 + + + +### switch.b:53,60 + + + +### switch.b:62,69 + + + +## Demo + + ; limbo switch.b + ; switch + Even + Odd + i's value: 9 + Valid hex + Quack! + This is binary + Neither 4 nor 7 + ; + +## Exercises + +- Try commenting out the `break` and/or `continue` keywords in the first switch, how does the behavior change? |
