EasyManuals Logo
Home>Texas Instruments>Desktop>TI-99/4A

Texas Instruments TI-99/4A User Reference Guide

Texas Instruments TI-99/4A
204 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 #74 background imageLoading...
Page #74 background image
FOR-
TO-STEP
After you enter a RUN command, but before your program is
performed.
the
computer checks to see that you have the same
number of
FOR-TO·STEP
and
NEXT
statements.
lfyou
do not
have the same number, the message
"FOR·NEXT
ERROR"
is
displayed and the program
is
not run.
If
you change the value of the control'variable while the loop
is
performed. the number of times the loop
is
repeated is affected.
In
TI
BASIC the expressions for initial-value, limit, and increment
are evaluated before
the
initial-value is assigned to the control-
variable.
Thus,
in
the program
on
the right.
in
line 110 the value 5
is
assigned to the limit before assigning a value to I
as
the control-
variable.
The
loop
is
repeated 5 times, not just once.
The
sign of the control-variable
can
change during the performance
of a
FOR-NEXT
loop.
When performing the
FOR
statement, the computer
checks
that the
limit exceeds the initial-value before
it
does the loop,
The
initial-
value
in
the
FOR
statement does not have to be 1.
The
computer
can begin
counting with whatever numeric value you wish.
However, if the
initial-value is greater than the limit and the
increment is positive, the loop will not be performed at all.
The
computer will continue on to the statement following the loop.
Similarly,
if
the increment
is
negative and you assign
an
initial-
value less
than
the limit, the loop will not be performed.
II-54
Examples:
>NEIN
>100
FOR
1;1
TO
10
>110
1;1+1
>120
PRINT
1
>130
NEXT
I
>140
PRINT
I
>150
END
>RUN
2
4
6
8
10
11
**
DONE
**
>NEIN
>100
1;5
>110
FOR
1;1
TO
I
>120
PRINT
1;
>130
NEXT
1
>14\) i:.ND
>RUN
1
234
5
**
DONE
**
>N
Ell
>100
FOR
1=2
TO
-3
STEP
-1
>110
PRINT
I;
>120
NEXT
1
;.130
END
>R
UN
2 1 0
-1
-2
-3
**
DONE
**
>NEIN
>100
REM
INITIAL
VALUE
TOO
GREAT
>110
FOR
1=6
TO
5
>120
PRINT
1
>130
NEXT
I
>140
END
>RUN
**
DONE
**
User's Reference Guide

Other manuals for Texas Instruments TI-99/4A

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TI-99/4A and is the answer not in the manual?

Texas Instruments TI-99/4A Specifications

General IconGeneral
BrandTexas Instruments
ModelTI-99/4A
CategoryDesktop
LanguageEnglish

Related product manuals