The Graphics Commands; The Loop Commands - HP 39gs Master Manual

Graphing calculator
Hide thumbs Also See for 39gs:
Table of Contents

Advertisement

T
h
e
G
r
a
p
h
i
c
s
c
o
T
h
e
G
r
a
p
h
i
c
s
c
See the chapter "Programming the hp 39gs & hp 40gs" beginning on page 255 for examples illustrating
some of the graphics commands that I have used regularly. Consult the manual for more.
T
h
e
L
o
o
p
c
o
m
m
T
h
e
L
o
o
p
c
o
m
m
FOR <variable> = <start value> TO
<end value> [STEP <increment>] <statements> END
For those familiar with the Basic language in other forms, this is a
standard FOR...NEXT command, except without the 'NEXT'. The
value is optional and is assumed to be 1 if not stated.
Note: Whatever you do, don't use NEXT to terminate the loop! It doesn't
register as an error but all sort of strange things happen!
DO <statements> UNTIL <test clause> END
This loop executes the statements within it until the test clause evaluates
as true. It must execute at least once because the test is not done until
the end of the loop.
The example right checks for a positive integer from the
statement. To be even more user friendly you could let the user know
what they had done wrong by adding another few lines of code within
the
loop of..
DO
IF INT(N)
N OR N
MSGBOX "Enter a positive integer only":
END:
WHILE <test clause> REPEAT <statements> END
This is similar to the
DO...UNTIL
may not be executed at all.
These two loops are very similar and, except in some odd situations, are interchangeable.
m
m
a
n
d
s
o
m
m
a
n
d
s
a
n
d
s
a
n
d
s
0 THEN
loop except that the test clause is evaluated before starting so that the loop
STEP
INPUT
291

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

40gs

Table of Contents