Labels - Casio FX-890P Owner's Manual

Casio personal computer owner's manual
Table of Contents

Advertisement

Note: GOSUB routines can also be used to branch to other program areas, as in
GOSUB #3 (branches to program area 3). Note, however, that a return must be
made back to original program area using the RETURN command before an END
command is executed.
5.5.10
You have the possibility to assign label names to program lines. This feature allows
an easier understanding of the program structure, especially GOTO and GOSUB
statements.
We will modify the program of chapter 5.5 using labels:
10 *Start:S=0
20 RESTORE
30 INPUT N
40 IF N>5 THEN N=5
50 IF N=0 THEN GOTO *Finish
60 FOR I=1 TO N
70 READ X
80 S=S+X
90 NEXT I
100 GOSUB *Root
110 PRINT S;Y;Z
120 GOTO *Start
130 *Finish:END
140 *Root:REM SQR/CUBE ROOT
150 Y=SQR S
160 Z=CUR S
170 RETURN
180 DATA 9,7,20,28,36
Label names follow the same rules as variable names, except that they are not
limited to 15 characters.

Labels

Clear current total assigned to S
Specifies read op. should begin with 1
Input the number of data items to be read
Input of values greater than 5 is treated as 5
Jump to program end when input is zero
This section is repeated the number of times
specified by operator input in line 30
Branch to subroutine labeled Root
Displays contents of variables S,Y,Z
Jump to program begin
Program end
Remarks
Square root calculation
Cube root calculation
Return to statement following the GOSUB
Data read by READ statement in line 70
35
st
data item

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Z-1grZ-1

Table of Contents