Conditional test
Top  Previous  Next

Definition

: conditional test (=,<,>); true commands ; false commands ;

Usage

The conditional test works like the IIF function from visual basic. A good reference on the use of IIF can be found in the wikipedia IIF


:
The colon indicates the start of the conditional test
; The first semi-colon is the start of the true SDL
; The second semi-colon is the start of the false SDL
; The third semi-colon ends the false code and is the end of the conditional statement

All four, the colon and three semi-colons must be present to form a valid conditional statement.

Example

To toggle a heading between 90 and -90 degrees based on its current setting:

: a = 90 ; <a=-90> ; < a=90> ;

Test : Is a = 90 ; If true set a = -90 ; If false set a = 90 ;