If Else If Else EndIf
if expr1 test expr2 then
…
else if expr1 test expr2 then
…
else
…
endif
These statements allow conditional execution of FISH code segments; else and else if are optional, and the word then may be omitted if desired. The item test consists of one of the following symbols, or symbol pairs:
= # > < >= <=
The meanings are standard, except for #, which means “not equal.” The items expr1 and expr2 are any valid algebraic expressions (which can involve functions, PFC variables, etc.). If the test is true, then the statements immediately following if are executed until else or endif is encountered. If the test is false, the statements between else and endif are executed if the else statement exists; otherwise, control jumps to the first line after endif. All the given test symbols may be applied when expressions expr1 and expr2 evaluate to integers or floating-point values (or a combination of the two). If both expressions evaluate to strings, then only two tests are valid: = and #; all other operations are invalid for strings. Strings must match exactly for equality. Similarly, both expressions may evaluate to pointers, but only = and # tests are valid.
IF … elseIF … else … endif clauses can be nested to any depth.
Was this helpful? ... | PFC 6.0 © 2019, Itasca | Updated: Nov 19, 2021 |