EasyManuals Logo

IBM 5100 Basic Reference Manual

IBM 5100
187 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
Page #76 background imageLoading...
Page #76 background image
72
If
the
initial value
to
be assigned
to
the
control. variable
is
greater
than
(or less
than for negative increments)
the
final value when
the
FOR statement
is
evaluated,
the
loop
is
not
executed, no value
is
assigned
to
the control, variable, and execution
proceeds with
the
first executable statement following
the
associated NEXT
statement.
If
the
value
of
the
STEP arithmetic expression
is
zero,
the
FOR loop
is
executed
an infinite number
of
times,
or
until
the
value
of
the
control variable
is
purposely
set beyond
the
specified final value.
Transfer
of
control into
or
out
of
a FOR loop
is
permitted; however, a NEXT
statement cannot be executed unless its corresponding FOR statement has been
executed previously.
FOR loops can be nested within one another as long
as
the
internal FOR loop
falls entirely within
the
external FOR loop (see the following example). Nested
FOR loops should not use
the
same control variable.
The maximum number
of
nested FOR loops
is
15.
Example
The following example shows a simple FOR loop
that
increases the control variable
by 2 until the value
of
25
is
exceeded.
20 FOR I
= 1 TO
25
STEP 2
90
NEXT I
The next example shows the correct technique for nesting FOR loops. The inner
loop
is
executed 100 times for each execution
of
the
outer
loop.
10
FOR J = A TO B STEP C
150 FOR K
= 1 TO
100
250
NEXT K
300
NEXT J
/
/

Table of Contents

Other manuals for IBM 5100

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the IBM 5100 and is the answer not in the manual?

IBM 5100 Specifications

General IconGeneral
Release Year1975
RAM16 KB - 64 KB
Storage204 KB tape drive
Display5-inch CRT
Operating SystemAPL/BASIC
ProcessorIBM PALM (1.9 MHz)

Related product manuals