Sharp EL-5230, EL-5250 operation manual Flow control, Gosub

Models: EL-5230 EL-5250

1 132
Download 132 pages 22.67 Kb
Page 83
Image 83

Chapter 7: Programming

Flow control

Command

Key

Description

Examples

operations

Label

i 6

Indicates a destination point for

Label LOOP1

<label name>

 

the flow statements Goto and

Label LOOP2

 

 

Gosub. Up to seven letters can

 

 

 

be used for the label name.

 

 

 

Each label name must be

 

 

 

unique. You cannot use the

 

 

 

same label name more than

 

 

 

once in a program. Up to 20

 

 

 

different labels can be used in

 

 

 

each program.

 

 

 

 

 

Clrt

i 7

Clear the text displayed on the

Clrt

 

 

screen.

 

 

 

 

 

If

i 8

The If clause must be followed

If B≥=1 Goto

<condition>

 

by a conditional statement and

LOOP1

Goto

i 9

then a Goto command. Goto is

 

<label name>

 

the only command allowed to

 

 

 

be used after the If clause. You

 

 

 

can enter ; s before

 

 

 

the Goto command to make the

 

 

 

line easier to read.

 

 

 

 

 

Goto

i 9

Causes the program to jump to

Goto LOOP2

<label name>

 

the stated Label (specified by a

 

 

 

Label command). A Goto

 

 

 

statement must have a

 

 

 

corresponding Label statement

 

 

 

line that indicates where to go.

 

 

 

 

 

Gosub

i A

Runs the subroutine beginning

Gosub PART1

<label name>

 

at the stated Label (specified by

 

 

 

a Label command). A Gosub

 

 

 

statement must have a

 

 

 

corresponding subroutine that

 

 

 

starts after the Label statement

 

 

 

and ends with a Return

 

 

 

command. Subroutines can be

 

 

 

nested up to ten levels deep.

 

 

 

 

 

Return

i B

Defines the end of a subroutine.

Return

 

 

Operation returns to the

 

 

 

command following the

 

 

 

corresponding Gosub

 

 

 

statement.

 

 

 

 

 

81

Page 83
Image 83
Sharp EL-5230, EL-5250 operation manual Flow control, Gosub