Resume line number, If true/false expression then action-clause – BrightSign HD2000 BrightScript Reference Guide User Manual

Page 16

Advertising
background image

16


Use ON ERROR GOTO 0 to deactivate the ON ERROR.

RESUME line number

Terminates an error handling routine by specifying where normal execution is to resume.

RESUME without a line number and RESUME 0 cause the Interpreter to return to the statement in which the
error occurred.

RESUME followed by a line number causes the Interpreter to branch to the specified line number.
RESUME NEXT causes the Computer to branch to the statement following the point at which the error
occurred.

Sample Program with an Error Handling Routine
5 ON ERROR GOTO 100
10 INPUT"SEEKING SQUARE ROOT OF";X
20 PRINT SQR(X)
30 GOTO 10
100 PRINT "IMAGINARY ROOT:";SQR(-X);"*I"
110 RESUME 10

REM

Instructs the Interpreter 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 true/false expression THEN action-clause

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 logical or relational
expression. If the expression is True, control will proceed to the "action" clause 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.

In numerical terms, if the expression has a non-zero value, it is always equivalent to a logical True.
Examples:
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 an ambiguity. For example:
IF Y=M THEN M=O won't work without THEN.

INPUT A$: IF A$="YES" THEN yes_here
INPUT A$: IF A$="YES" GOTO yes_here

The two statements have the same effect.

IF A>0 AND B>0 PRINT "BOTH POSITIVE"

Advertising
This manual is related to the following products: