Return – Remote Processing CAMBASIC User Manual

Page 142

Advertising
background image

Comm ands - 109

RETURN

Statement

SYNTAX:

R E T U R N [line/label]
RETURN ITR number

PURPOSE:

To resume execution after a GOSUB, interrupt, multitasking or communications call. The RETURN
ITR r eenables the interru pt.

REMARK S:

RETU RN is used as a return from a GOSUB call. Program execution continues at the statement
followin g the GO SUB.

number is 0 or 1, or as limited by your har dware. It is the interrupt number that the subroutine
declared by ON ITR n declared.

If the optional line/ label is specified, the progr am w ill branch to th e specified line/ label.

RET URN ITR is use d as a retu rn fro m an O N ITR GOSU B declaratio n. In this case the r eturn is to
the next statement where the interrupt occurred. The hardware interrupt is reenabled. If ITR
number is left off, the return is still to the next statement where the interrupt occurred. However,
interr upt number is disabled until a RETURN ITR number is executed or ON IT R GO SUB is
declared again. This is useful when you want to recognize an interrupt once and enable it again at
some later time.

RELATED:

GOSUB, ON ITR

EXAMPLE:

10 ON ITR 0 GOSUB 40
20 A=23 : 'This is a dummy loop
30 GOTO 20
40 PRINT "Interrupt"
50 RETURN ITR 0

ERROR:

< R E T U R N w / o G O S U B> – i f n o co r r es p on d in g GO S U B
< Can’t compile> – if line/labe l does not exist
< Data out of range> - if number is not 0 or 1 when used with ITR
< Expected (> - if number is missing when used with an ITR

Advertising