beautypg.com

BrightSign BrightScript 2 Reference Guide User Manual

Page 25

background image

25

In each case, the variable on the left side of the equals sign is assigned the value of the
constant or expression on the right side.

END

Terminates execution normally.

STOP

Interrupts execution return a STOP error. Invokes the debugger. Use “cont” at the debug
prompt to continue execution, or “step” to single step.

GOTO label

Transfers program control to the specified line number. GOTO label results in an
branch. A label is an identifier terminated with a colon, on a line by itself. Example:


mylabel:
print “Anthony was here!”
goto mylabel

RETURN expression

Used to return from a function back to the caller. If the function is not of type Void,
return can return a value to the caller.

FOR counter = exp TO exp STEP exp NEXT counter

Creates an iterative (repetitive) loop so that a sequence of program statements may be
executed over and over a specified number of times. The general form is (brackets
indicate optional material):

FOR counter-variable = initial value TO final value [STEP increment]
[program statements]
NEXT [counter-variable]

In the FOR statement, initial value, final value and increment can be any expression. The
first time the FOR statement is executed, these three are evaluated and the values are
saved; if the variables are changed by the loop, it will have no effect on the loop's
operation. However, the counter variable must not be changed or the loop will not operate
normally. The first time the FOR statement is executed the counter is set to the "initial
value” and to the type of “initial value”.

At the top of the loop, the counter is compared with the final value specified in the FOR
statement. If the counter is greater than the final value, the loop is completed and