Conditional Action Statement
Specify a set of action statements for conditional execution.
if BOOLEAN_VALUE then
[ACTION_STATEMENT] ...
[else
[ACTION_STATEMENT] ...]
end if
BOOLEAN_VALUE
A boolean value or an expression that evaluates to a boolean value. An expression must be enclosed in parentheses.
ACTION_STATEMENT
An action statement.
Description
Use this statement to specify a set of action statements you want performed if a specified condition is true, and other alternative optional action statements you want performed if the condition is false.
The if statement is a conditional action statement. You can use it within a response definition or an action routine definition, or within a loop statement, or even within another conditional action statement. You can specify blocks within conditional action statements, and vice versa.
You specify both the condition and the actions in a conditional action statement. A conditional action statement must begin with the if statement, contain a then clause, and end with the end if keywords. The else clause is optional.
ESL first evaluates the boolean expression specified in the if statement. If the boolean expression is true, ESL performs the action statements specified in the then clause; the else clause (if specified) is ignored. If the boolean expression is false, ESL performs the action statements specified in the else clause (if specified); the then clause is ignored.
After executing the then clause or the else clause, ESL continues normal program execution at the action statement (if any) immediately following the end if keywords.
You can nest conditional action statements to any number of levels. Remember that you must specify the end if keywords corresponding to each if keyword.
If the program is compiled with External Strings, then any string literals used in this statement will be externalized.
Example
response to Tester2
if (TestSuccessFlag) then
if (A > B) then
...
else
...
end if
end if
action CheckSize is
if (A > B) and (Count < MaxCount) then
append Count to Log
copy (Count+1) to Count
end if
See Also
Expressions, Operators, and Operands
while loop Action Statement