468
Programming
FOR Y FROM Ymin TO Ymax STEP yincr DO
color := FLOOR(X^2+Y^2) MOD 4;
PIXON(X,Y,color);
END;
END;
FREEZE;
END;
FOR DOWN
Syntax:
FOR
var
FROM
start
DOWNTO
finish
DO
commands
Sets variable
var
to
start
, and for as long as this variable
is less than or equal to
finish
, executes the sequence of
commands
, and then adds 1 (
increment
) to
var
. If
DOWNTO
is used the
start
value of the variable is decreased until the
finish
value is reached.
FOR DOWN STEP
Syntax:
FOR
var
FROM
start
DOWNTO
finish
[
STEP
increment
]
DO
commands
Sets variable
var
to
start
, and for as long as this variable
is less than or equal to
finish
, executes the sequence of
commands
, and then adds 1 (
increment
) to
var
. If
DOWNTO
is used the
start
value of the variable is decreased until the
finish
value is reached.
WHILE
Syntax:
WHILE
test
DO
commands
END
;
Evaluate test. If result is true (not 0), executes the
commands
, and repeat.
Example: A perfect number is one that is equal to the sum
of all its proper divisors. For example, 6 is a perfect
number because 6 = 1+2+3. The example below returns
true when its argument is a perfect number.
EXPORT ISPERFECT(n)
BEGIN
LOCAL d, sum;
2
d;
1
sum;
WHILE sum < = n AND d < n DO
IF irem(n,d)==0 THEN
Summary of Contents for NW280-200X
Page 1: ...HP Prime Graphing Calculator User Guide ...
Page 4: ......
Page 56: ...50 Reverse Polish Notation RPN ...
Page 64: ...58 Computer algebra system CAS ...
Page 107: ...An introduction to HP apps 101 ...
Page 108: ...102 An introduction to HP apps ...
Page 188: ...182 Spreadsheet these variables is provided in chapter 21 Variables beginning on page 373 ...
Page 220: ...214 Statistics 2Var app ...
Page 252: ...246 Linear Solver app ...
Page 258: ...252 Parametric app ...
Page 268: ...262 Sequence app ...
Page 404: ...398 Units and constants ...
Page 416: ...410 Lists ...
Page 442: ...436 Notes and Info ...
Page 532: ...526 Limiting functionality ...
Page 536: ...530 ...
Page 540: ...534 ...