Forms-Based Application Development Tools User Guide > Part 2: Vision > C. Template Files Reference > if then else endif Statement--Process Conditional Statements
Was this helpful?
if then else endif Statement--Process Conditional Statements
Processes a set of statements based on the value of a Boolean substitution variable or an expression that evaluates to a Boolean value:
Processes the statements if the variable returns a value of TRUE (TRUE is equal to the string "1")
If the variable returns a value of FALSE, processes the statements in an else clause, if such a clause is included (FALSE is equal to the string "0")
If the variable returns a value of FALSE and no else clause is included, ignores all statements up to the endif statement
If a variable name ($variable) is used in a Boolean expression to compare with a string value, the variable must be in single quotes ('$variable').
The if-endif statements are required; the else clause is optional. If-endif blocks can be nested to 20 levels deep.
This statement has the following syntax:
## if $variable | Boolean expr then {statement}
[## else {statement}]
## endif
Examples—if then else endif statement:
The following statement evaluates to True if the substitution variable $frame_name is the string 'myframe':
## IF ('$frame_name'='myframe') THEN
   code to execute for 'myframe'
## ENDIF
The following statements generate a Lookup table if the variable $lookup_exists is defined:
## IF $lookup_exists THEN
## GENERATE LOOKUP
## ENDIF
The following statements generate code according to whether the frame is a big frame or not.
## if (('$frame_name'='big'+'one') or ($bigframe=TRUE))
## THEN
   code to execute for big frame
## ELSE
   code to execute for not big frame
## ENDIF
Last modified date: 08/28/2024