You can nest conditional action statements to any number of levels; that is, you can specify conditions within other conditions. Note that you must specify the end if keywords corresponding to each if test; for example:
if (TestSuccessFlag) then
if (A > B) then
copy A to K
send A_Msg to Recorder
else
send B_Msg to Recorder
end if
end if
copy A to Log
ESL initially evaluates the boolean in the first if statement. If the value of the TestSuccessFlag variable is true, ESL executes the then clause. The first action statement in the then clause is another if statement:
if (A > B) then
ESL evaluates this boolean. If A is greater than B, ESL executes the then clause:
copy A to K
send A_Msg to Recorder
ESL ignores the else clause and continues execution at the statement following the second end if:
copy A to Log
If A is not greater than B, ESL executes the else clause:
send B_Msg to Recorder
ESL ignores the then clause and continues execution at the statement following the second end if:
copy A to Log
If the value of the TestSuccessFlag variable is false, the result of the first boolean is false, and ESL ignores the entire outer then clause. Because there is no else clause corresponding to this condition, ESL continues execution at the statement following the second end if:
copy A to Log