summaryrefslogtreecommitdiff
path: root/Switch/README.md
blob: 92be1f4ade39868bbb7c19774a3e276c0ebee998 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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?