FKiSS If-Endif Structure

See Also: ifequal, ifnotequal, ifgreaterthan, iflessthan, else, elseifequal, elseifnotequal, elseifgreaterthan, elseiflessthan, endif

Description

If-Endif conditional structure allows you to define special conditions under which blocks of action code are processed or ignored.
A block of action code can contain one or more actions.
FKiSS defines four types of if commands:
FKiSS4 also defines four corresponding types of elseif commands:
In any If-Endif conditional block, only one action sub-block will be be processed. If there are multiple sub-blocks, only the first one which has a true if/elseif will be processed.
If a previous If-Endif block has not been closed with Endif when an If is encountered, an implicit Endif is assumed.
Nested If-Endif blocks are not allowed.

If-Endif

The simplest If-Endif conditional structure is:
;@ ifcommand(A)
;@   action
;@ endif()
In this example, action will only be processed if A is true.
action can be any number of action commands.

If-Else-Endif

A slightly more complicated If-Endif conditional structure is:
;@ ifcommand(A)
;@   action1
;@ else()
;@   action2
;@ endif()
In this example, action1 will be processed if A is true.
If A is not true, action2 will be processed.

If-Elseif-Else-Endif

With FKiSS4, a more complicated If-Endif conditional structure is:
;@ ifcommand(A)
;@   action1
;@ elseifcommand(B)
;@   action2
;@ else()
;@   action3
;@ endif()
In this example, action1 will be processed if A is true.
If A is not true and B is true, action2 will be processed.
If A is not true and B is not true, action3 will be processed.
An If-Elseif-Endif conditional chain may contain as many Elseif statements as you need.