TEMPLATE Procedure: Creating Markup Language Tagsets

Event Statement Conditions

Event statement conditions specify one or more conditions that must be true for a DEFINE EVENT statement to execute. An event statement condition must be preceded by a slash (/).
Event statement conditions have the following form:
define-event-statement </ event-statement-condition(s)>;
specifies a DEFINE EVENT statement.
specifies a condition to evaluate.
event-statement-condition is one of the following:
ANY (variable-1,<..., variable-n>)
checks a list of comma-delimited variables for values. If any of the variables has a value, then the condition is true.
put 'One of our variables has a value!'
    nl/if any(background, foreground, cellpadding, cellspacing);  
stops an event that is executing. The current statement is executed and the event ends.
Tip:Using the BREAKIF condition is more efficient than using a PUT event statement and a BREAK event statement with an IF condition together. For example, the following statements are equivalent:
put 'Foreground has a value!' /breakif exists(foreground); 
put 'Foreground has a value!' /if exists(foreground);
 break /if exists(foreground);
CMP (“string”, variable | variable-list)
compares, for equality, a string to a variable or list of variables.
 put 'The foreground is blue!' nl/if cmp('blue',foreground);
CONTAINS (argument-1, argument-2)
searches the first argument for the second argument.
set $myvariable 'some random text';
 put 'myvariable contains 'ran' nl/if contains($myvariable, 'ran'); 
EXIST | EXISTS (variable | variable-list)
determines whether a variable or a list of variables has values. If all of the variables have values, then the condition is true. If a variable has an empty string of length 0, then the variable has no value and the condition is false.
Tip:Use the MISSING event variable with the EXIST condition to determine whether a value is missing.
put 'All of our variables have a value!'
    nl/if exists(background, foreground, cellpadding, cellspacing); 
IF | WHEN | WHERE (<value><'string'><variable>)
tests for existence or equality. IF, WHEN, and WHERE are optional and interchangeable. An IF, a WHEN, or a WHERE condition compares values and strings, or checks variables for values.
Restriction:When you specify an IF condition with a single, user-defined variable, then the variable is evaluated to determine whether it has a value, according to the variable's type. A string variable type uses the length to determine existence, a numeric variable type uses value, and a dictionary array variable type uses the key (if there is a key specified, then the test is true).
Example:All of the following are equivalent:
put 'Foreground has a value!' nl/if (foreground);
 put 'Foreground has a value!' nl/if exists(foreground);
 put 'Foreground has a value!' nl/when exists(foreground);
 put 'Foreground has a value!' nl/exists(foreground);
 put 'Foreground has a value!' nl/where existsforeground);
NOT | ! | ^ <'string'><variable>
negates a condition. You can use the keyword NOT or the characters '!' or '^'.
Restriction:The character '!' works only as the first character in a condition. The standard WHERE processing syntax is required for subsequent characters.
put 'The foreground is not red!' nl/if not cmp('red', foreground);
 put 'The foreground is not red or blue' /if !cmp('red', foreground)
      and ^cmp('blue', foreground);
 put 'The foreground is not red or blue' /if ^cmp('red', foreground)
      and ^cmp('blue', foreground);
WHILE condition-expression
indicates that the corresponding statement block should loop until the WHILE value becomes false.
Restriction:The WHILE condition can be used only with the DO statement.
eval $count 0;

  do /while $count < 10;
     eval $i $count+1;
     continue /if $count eq 5;
     stop /if $count eq 8;
     put 'Count is ' $i nl;
     put 'Count was never less than 10' nl;