BrightSign BrightScript 2 Reference Guide User Manual
Page 27

27
While expression / Exit While
The While loop executes until expression is false. The “exit while” statement can be
used to terminate a while loop prematurely.
Example:
k=0
while k<>0
k=1
Print “loop once”.
end while
while true
Print “loop once”
Exit while
End while
REM
Instructs the compiler to ignore the rest of the program line. This allows you to insert
comments (REMarks) into your program for documentation. An „ (apostrophe) may be
used instead of REM.
Examples Program:
rem ** this remark introduces the program **
'this too is a remark
IF expression THEN statements [ELSE statements]
There are two forms of the IF THEN ELSE statement. The single line form (this one),
and the multi-line or block form (see next section). The IF 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 the matching ELSE statement (if there is one) or down to the next program line.
Examples:
if x>127 then print "out of range" : end
if caveman=”fred” then print “flintsone” else print “rubble”
NOTE: THEN is optional in the above and similar statements. However, THEN is
sometimes required to eliminate an ambiguity. For example:
if y=m then m=o „won't work without THEN.
BLOCK IF, ELSEIF, THEN, ENDIF
The multi-line or block form of IF THEN ELSE is more flexible. It has the form: