T
T
h
h
e
e
G
G
r
r
a
a
p
p
h
h
i
i
c
c
s
s
c
c
o
o
m
m
m
m
a
a
n
n
d
d
s
s
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
T
h
h
e
e
L
L
o
o
o
o
p
p
c
c
o
o
m
m
m
m
a
a
n
n
d
d
s
s
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
STEP
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
INPUT
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
DO
loop of..
IF INT(N) N OR N 0 THEN
MSGBOX “Enter a positive integer only”:
END:
WHILE <test clause> REPEAT <statements> END
This is similar to the
DO…UNTIL
loop except that the test clause is evaluated before starting so that the loop
may not be executed at all.
These two loops are very similar and, except in some odd situations, are interchangeable.
291