
Page 21-61
Example – generate a list of numbers using a FOR…STEP construct
Type in the program:
«
→
xs xe dx
«
xe xs – dx / ABS 1. +
→
n
«
xs xe FOR x x
dx STEP n
→
LIST
» » »
and store it in variable
@GLIS2
.
Θ
Check out that the program call 0.5
`
2.5
`
0.5
`
@GLIS2
produces the list {0.5 1. 1.5 2. 2.5}.
Θ
To see step-by-step operation use the program DBUG for a short list, for
example:
J
1
#
1.5
#
0.5
`
Enter parameters 1 1.5 0.5
[‘]
@GLIS2
`
Enter the program name in level 1
„°LL
@)@RUN@ @@DBG@
Start the debugger.
Use
@SST
↓
@
to step into the program and see the detailed operation of each
command.
The DO construct
The general structure of this command is:
DO program_statements UNTIL logical_statement END
The DO command starts an indefinite loop executing the program_statements
until the logical_statement returns FALSE (0). The
logical_statement
must
contain the value of an index whose value is changed in the
program_statements
.
Example 1 - This program produces a counter in the upper left corner of the
screen that adds 1 in an indefinite loop until a keystroke (press any key) stops
the counter:
«
0 DO DUP 1 DISP 1 + UNTIL KEY END DROP
»
Command KEY evaluates to TRUE when a keystroke occurs.
Example 2 – calculate the summation S using a DO…UNTIL…END construct
Summary of Contents for 50G
Page 1: ...HP g graphing calculator user s guide H Edition 1 HP part number F2229AA 90006 ...
Page 130: ...Page 2 70 The CMDS CoMmanDS menu activated within the Equation Writer i e O L CMDS ...
Page 206: ...Page 5 29 LIN LNCOLLECT POWEREXPAND SIMPLIFY ...
Page 257: ...Page 7 20 ...
Page 383: ...Page 11 56 Function KER Function MKISOM ...
Page 715: ...Page 21 68 Whereas using RPL there is no problem when loading this program in algebraic mode ...
Page 858: ...Page L 5 ...