'when' statement updated.

This commit is contained in:
David Schmenk
2014-07-04 20:14:40 -07:00
parent f1bc3f2734
commit 33ef3f86a1

View File

@@ -268,26 +268,33 @@ Control structures affect the flow of control through the program. There are co
fin fin
``` ```
The when/is/otherwise/wend statement is similar to the if/elsif/else/fin construct except that it is more efficient. It selects one path based on the evaluated expressions, then merges the code path back together at the end. However only the 'when' value is compared against a list of expressions. The expressions do not need to be constants, they can be any valid expression. The list of expressions is evaluated in order, so for efficiency sake, place the most common cases earlier in the list. The when/is/otherwise/wend statement is similar to the if/elsif/else/fin construct except that it is more efficient. It selects one path based on the evaluated expressions, then merges the code path back together at the end. However only the 'when' value is compared against a list of expressions. The expressions do not need to be constants, they can be any valid expression. The list of expressions is evaluated in order, so for efficiency sake, place the most common cases earlier in the list. Just as in C programs, a 'break' statement is required to keep one clause from falling through to the next. Falling through from one clause to the next can have it's uses, so this behavior has been added to PLASMA.
``` ```
when keypressed when keypressed
is keyarrowup is keyarrowup
cursup cursup
break
is keyarrowdown is keyarrowdown
cursdown cursdown
break
is keyarrowleft is keyarrowleft
cursleft cursleft
break
is keyarrowright is keyarrowright
cursright cursright
break
is keyctrlx is keyctrlx
cutline cutline
break
is keyctrlv is keyctrlv
pasteline pasteline
break
is keyescape is keyescape
cursoff cursoff
cmdmode cmdmode
redraw redraw
break
otherwise otherwise
bell bell
wend wend