Language Reference

RETURN

Example

Interrupt operation of current user-de￿ned function, then return to the point where the function was originally encountered.

The following example contains a user-de￿ned function, called PROGRAM 1, nested inside another function, called PROGRAM 2, which itself is nested inside another function called PROGRAM 3. Thus, PROGRAM 3 executes PROGRAM 2, and PROGRAM 2 executes PROGRAM 1. PROGRAM 1 displays numbers (100, 200, 300, and 400), and also contains the RETURN command. When RETURN is encountered, operation returns to PROGRAM 2.

5

OUTPUT

723;"IP;"

 

Instrument preset.

 

 

 

10

OUTPUT

723;"CLRDSP;"

Clear graphics from memory.

 

 

 

20

OUTPUT

723;"TRDSP TRA,OFF;"

Turn o￿ trace A.

 

 

 

30

OUTPUT

723;"ANNOT OFF;GRAT OFF;"

Blank annotation and graticule .

 

 

 

40

OUTPUT

723;"VARDEF

YY,0;"

De￿ne user-de￿ned variable equal to 0.

 

 

 

50

!

 

 

 

 

 

 

 

 

 

60

OUTPUT 723;"FUNCDEF

PROGRAM_1,^";

De￿ne ￿rst user-de￿ned function, PROGRAM

 

1,

 

 

 

 

 

that prints YY + 100 until YY equals 300.

 

 

 

70

OUTPUT 723;"REPEAT;";

Begin repeat loop .

 

 

 

80

OUTPUT 723;"ADD YY,YY,100;";

Add 100 to YY .

 

 

 

90

OUTPUT 723;"PU;PA 100,YY;PD;";

Position pen at (100,YY).

 

 

 

100 OUTPUT 723;"DSPLY YY,4,0;";

Write value for YY .

 

 

 

110

OUTPUT

723;"IF YY,EQ,300;THEN;RETURN;ENDIF;";

If YY equals 300, execute RETURN, then skip

 

 

 

 

 

 

 

to line 170 and execute the next analyzer

 

 

 

120

OUTPUT

723;"UNTIL YY,EQ,400;";

command following PROGRAM

 

1.

 

 

 

End loop when YY equals 400.

 

 

 

130 OUTPUT 723;"^;"

 

 

 

 

 

 

 

 

140 !

 

 

 

 

 

 

 

 

 

150 !

 

 

 

 

 

 

 

 

 

160 OUTPUT 723;"FUNCDEF PROGRAM_2,";

De￿ne second user-de￿ned function, PROGRAM

 

 

2.

 

7-418