122-32000 Parallax Inc, 122-32000 Datasheet - Page 173

MANUAL PROPELLER

122-32000

Manufacturer Part Number
122-32000
Description
MANUAL PROPELLER
Manufacturer
Parallax Inc
Datasheets

Specifications of 122-32000

Accessory Type
Manual
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
Propeller Education (PE) Kit
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
expression that is a match has its block of code executed; no further expressions are tested
after that. This means that if we had rearranged the 25 and 20..30 lines, so that the range of
20..30 is checked first, we’d have a bug in our code. We did this below:
The above example contains an error because, while
expression would never be tested since the previous one, 20..30 would be tested first, and
since it is true, its block is executed and no further match expressions are checked.
Variations of Statement(s)
The above examples only use one line per Statement(s) block, but each block can be many
lines of course. Additionally, the Statement(s) block may also appear below, and slightly
indented from, the MatchExpression itself.
variations.
case X+Y
case A
case A
10, 15: !outa[0]
20..30: !outa[2]
25
4
Z+1
10..15: !outa[3]
4:
Z+1:
10..15:
!outa[0]
!outa[1]
!outa[2]
!outa[3]
: !outa[1]
: !outa[0]
: !outa[1]
!outa[2]
'Test X+Y
'X+Y = 10 or 15? Toggle P0
'X+Y in 20 to 30? Toggle P2
'X+Y = 25? Toggle P1 <-- THIS NEVER RUNS
'Test A
'A = 4? Toggle P0
'A = Z+1? Toggle P1
'And toggle P2
'A in 10 to 15? Toggle P3
'Test A
'A = 4?
'Toggle P0
'A = Z+1?
'Toggle P1
'And toggle P2
'A in 10 to 15?
'Toggle P3
4: Spin Language Reference –
The following two examples show these
X + Y
could be equal to 25, that match
Propeller Manual v1.0 · Page 173

Related parts for 122-32000