EasyManua.ls Logo

Casio FX-795P - GOSUB {Branch location}; RETURN

Casio FX-795P
133 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
154
CHAPTER
7
©
Command
Reference
mn,
Explanation:
1)
Repeats
process
contained
between
FOR
and
NEXT
statements
a
number
of
times
specified
by
the
control
variable.
The
value
of
this
variable
is
changed,
from
the
initial
to
the
final
one,
by
the
increment
for
each
repetition
of
the
process.
When
the
value
of
the
control
variable
exceeds
the
final
value,
repeti-
tion
is
terminated.
:
2)
When
the
initial
value
is-larger
than
the
final
value,
the
execution
between
FOR
~
NEXT
is
performed
only
once.
3)
When
the
increment
is
positive,
the
value
of
the
control
variable
increases
by
each
increment.
When
the
increment
is
0,
execution
will
be
repeated
end-
lessly.
When
the
increment
is
negative,
the
value
of
the
control
variable
decreases
by
each
increment.
If
increment
is
omitted,
one
will
be
specified.
4)
A
NEXT
statement
must
always
correspond
to
a
FOR
statement
and
must
be
written
after
it.
5)
FOR.~
NEXT
loops
can
have
the
following
nested
structure.
1@
FORI=1
TO
10
20
FOR
J=11
TO
2@
30
PRINT
U3%373
]
4@
NEXT
J
50
NEXT
|
60
END
6)
Nesting
can
be
performed
with
up
to
4
levels.
7)
When
a
FOR
~
NEXT
loop
is
terminated,
the
value
of
the
control
variable
exceeds
the
final
value
by
the
value
of
the
increment.
8)
A
branching
out
of
a
FOR
~
NEXT
loop
can
be
performed.
If
branching
inside
a
FOR
~
NEXT
loop
by
an
IF
statement
or
GOTO
statement
is
attempted,
an
error
occurs.
7-2
Program
Commands
Branched
line
No.
iG)
Line
No.
#
program
area
No.
“Number
0
to
9
GOSUB
Function:
Performs
a
branching
to
a
specified
subroutine.
Parameter:
Line
No.:
1
to
9999.
Program
area
No.:
0
to
9.
Explanation:
1)
Performs
a
branching
to
a
subroutine..A
return
from
this
subroutine
is
per-
formed
by
executing
RETURN.
.
2)
To
make
a
‘subroutine
inside
a
subroutine
is
called
nesting
which
can
be
performed
with
up
to
8
levels.
3)
Return
to
the
statement
next
to
the
GOSUB
statement
is
performed
by
RETURN.
4)
Return
to
the
main
routine
cannot
be
performed
by
an
IF
statement
or
GOTO
statement.
Therefore,
be
sure
to
perform
return
by
a
RETURN
state-
ment.
:
5)
When
the
branched
line
No.
does
not
exist,
an
error
(Error
4)
occurs.
*A
numeric
expression
can
also
be
used
for
a
branched
line
number
anda
‘pro-
gram
area
number.
Example:
10°
PRINT
“MAIN
106%
2@
GOSUB
100
3@
PRINT
“MAIN
30”
48
END
100
PRINT
“SUB
100”
11@
GOSUB
200
12@
RETURN
200
PRINT
“SUB
200”
210
RETURN
155

Related product manuals