Block if / elseif / then / endif – BrightSign BrightScript 3.0 Reference Manual User Manual

Page 46

Advertising
background image

41


Note: This is the single-line form of the IF THEN ELSE statement; see the next section for more details about the block
form of the IF THEN ELSE statement.


The

IF statement instructs the interpreter to test the following expression. If the expression is True, control will proceed to

the statements immediately following the expression. If the expression is False, control will jump to either the matching
ELSE statement (if there is one) or to the next program line after the block.

Example:
if x>127 then print "out of range" : end

Note: THEN is optional in the above and similar statements. However, THEN is sometimes required to eliminate ambiguity,
as in the following example.

Example:
if y=m then m=o 'won't work without THEN

Block IF / ELSEIF / THEN / ENDIF

The block (i.e. multi-line) form of IF / THEN / ELSE has the following syntax:

If BooleanExpression [ Then ]
[ Block ]
[ ElseIfStatement+ ]
[ ElseStatement ]
End If

ElseIfStatement ::=

Advertising