Then statement or line number or line label, Else statement or line number or line label, Block if, elseif, then, endif – BrightSign HD2000 BrightScript Reference Guide User Manual

Page 17

Advertising
background image

17

THEN statement or line number or line label

Initiates the "action clause" of an IF-THEN type statement. THEN is optional except when it is required to
eliminate an ambiguity, as in

IF A<0 THEN 100

. THEN should also be used in IF-THEN-ELSE

statements.

ELSE statement or line number or line label

Used after IF to specify an alternative action in case the IF test fails. (When no ELSE statement is used,
control falls through to the next program line after a test fails.)

Examples:
INPUT A$: IF A$="YES" THEN 300 ELSE END
IF A<B PRINT"A<B"ELSE PRINT"B<=A"
IF 1=1 THEN LABEL

BLOCK IF, ELSEIF, THEN, ENDIF

The multi-line or block form of IF THEN ELSE is more flexible. It has the form:

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

ElseIfStatement ::=
ElseIf BooleanExpression [ Then ]
[ Block ]

ElseStatement ::=
Else
[ Block ]


For example:

vp_msg_loop:
msg=wait(tiut, p)

if type(msg)="rovideoevent" then

if debug then print "video event";msg.getint()
if lm=0 and msg.getint() = meden then
if debug then print "videofinished"
retcode=5
return
endif
else if type(msg)="rogpiobutton" then
if debug then print "button press";msg
if esc0 and msg=b0 then retcode=1:return
if esc1 and msg=b1 then retcode=2:return
if esc2 and msg=b2 then retcode=3:return
if esc3 and msg=b3 then retcode=4:return
else if type(msg)="rotint32" then
if debug then print "timeout"
retcode=6
return
endif

goto vp_msg_loop

Advertising
This manual is related to the following products: