Current Page:
NeXtMidas Training
Macros - Part 1 (Basics)
Loops and Control Structures
IF
IF (Block)
|
|
- Block
IF :
- A block
IF starts with an IF <test> THEN
line and ends with an ENDIF line.
if value LT 0 then
say "the value is negative"
endif
- The block
IF can also have an ELSE clause that is executed
when the test is false.
if value LT 0 then
say "the value is negative"
else
say "the value is not negative"
endif
- The block
IF can have one or more ELSEIF blocks that
test for other other conditions when the previous one(s) have not been satisfied.
if value LT 0 then
say "the value is negative"
elseif value EQ 0 then
say "the value is zero"
else
say "the value is positive"
endif
- The use of
THEN is technically optional, but is strongly recommended.
|
|
|