| Group: | Flow Control |
| See also: | switch break default endsw |
| Function: | case | |
| Description: |
Inside a switch-endsw block case controls the execution of an alternative. If the condition of case is true, the following block is executed similar to an if-endif statement. The keyword break serves as end marker of case and leaves the switch block at the position of endsw. When break is omitted, the next consecutive case is processed. If the program's counter comes to default, the following block is executed in any case.
|
| Usage: | switch case (cond) break default endsw | |
proc (y) = sign (x)
switch
case (x<0) y = -1 break
case (x>0) y = 1 break
default y = 0 break ; this break has no effect
endsw
endp
sign(-eh)
Contents of y [1,] -1
| Group: | Flow Control |
| See also: | switch break default endsw |