paragraph.if Command/TCL

paragraph.if

Command paragraph.if Command/TCL
Applicable release versions: AP 6.1
Category TCL (746)
Description conditional branch statement in a paragraph

The if statement compares the two string operators. If they are both numeric, then they are compared numerically. If either or both cannot be converted to a number, then they are compared alphabetically.

Between the two strings is a single-character conditional operator which may be one of the following:

<,l Less Than
=,e Equal To
>,g Greater than

If the condition evaluates to true, then the paragraph processor starts searching from the beginning of the paragraph for a label which matches the one after the "go" statement, but which must be followed by a colon and a space. When this label is found, execution of the paragraph continues on the line containing the label.

One of the string parameters in an if statement is usually an input substitution.
Syntax if {"|'}string1{"|'} [<|l|=|e|>|g] {"|'}string2{"|'} then go label
Options
Example
if <<Input a number between 1 and 10:>> > 5 then go greater
display Less than or equal to 5
if 1 = 1 then go done
greater: display Greater than 5
done: * There must be a space after the colon

 This example asks the user for a number, and then prints a result based on the 
value of this number.  Note how the "if" statement is used on the 
third line to implement an unconditional branch.
Purpose
Related paragraph.introduction
paragraph.<<
paragraph.then
paragraph.go