diff options
| author | henesy <henesy.dev@gmail.com> | 2019-02-28 12:48:48 -0600 |
|---|---|---|
| committer | henesy <henesy.dev@gmail.com> | 2019-02-28 12:48:48 -0600 |
| commit | 7635c9c15d25fce6b392f9899a68a36cdd7c06c4 (patch) | |
| tree | a8bd043cdf9947f0b01d8a08e8c3504936ce32b8 /Switch/README.md | |
| parent | 412fcca30891a7ef374ef751cab950ef44df0d8a (diff) | |
add note about pete vnc ;; source, but no explanation for switch
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? |
