mirror of
https://github.com/badvision/lawless-legends.git
synced 2024-09-30 03:56:59 +00:00
Update 'when' statements.
This commit is contained in:
parent
33ef3f86a1
commit
bddcd41327
@ -403,13 +403,16 @@ The complex test case is handled with `when`. Basically a `if`, `elsifF`, `else`
|
|||||||
when key
|
when key
|
||||||
is 'A'
|
is 'A'
|
||||||
; handle A character
|
; handle A character
|
||||||
|
break
|
||||||
is 'B'
|
is 'B'
|
||||||
; handle B character
|
; handle B character
|
||||||
|
break
|
||||||
```
|
```
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
is 'Z'
|
is 'Z'
|
||||||
; handle Z character
|
; handle Z character
|
||||||
|
break
|
||||||
otherwise
|
otherwise
|
||||||
; Not a known key
|
; Not a known key
|
||||||
wend
|
wend
|
||||||
@ -424,12 +427,15 @@ byte a
|
|||||||
when TRUE
|
when TRUE
|
||||||
is (a <= 10)
|
is (a <= 10)
|
||||||
; 10 or less
|
; 10 or less
|
||||||
|
break
|
||||||
is (a > 10) AND (a < 20)
|
is (a > 10) AND (a < 20)
|
||||||
; between 10 and 20
|
; between 10 and 20
|
||||||
|
break
|
||||||
is (a >= 20)
|
is (a >= 20)
|
||||||
; 20 or greater
|
; 20 or greater
|
||||||
wend
|
wend
|
||||||
```
|
```
|
||||||
|
A `when` clause can fall-through to the following clause, just like C `switch` statements by leaving out the `break` at the end of a clause.
|
||||||
|
|
||||||
##### FOR \<TO,DOWNTO\> [STEP]/NEXT
|
##### FOR \<TO,DOWNTO\> [STEP]/NEXT
|
||||||
Iteration over a range is handled with the `for`/`next` loop. When iterating from a smaller to larger value, the `to` construct is used; when iterating from larger to smaller, the `downto` construct is used.
|
Iteration over a range is handled with the `for`/`next` loop. When iterating from a smaller to larger value, the `to` construct is used; when iterating from larger to smaller, the `downto` construct is used.
|
||||||
|
Loading…
Reference in New Issue
Block a user