HP Prime Graphing NW280AAABA manual +1 d END Return sum==n END, Export Perfectnums Begin

Models: Prime Graphing NW280AAABA

1 616
Download 616 pages 24.49 Kb
Page 538
Image 538

END;

d+1d; END;

RETURN sum==n; END;

The following program displays all the perfect numbers up to 1000:

EXPORT PERFECTNUMS()

BEGIN

LOCAL k;

FOR k FROM 2 TO 1000 DO

IF ISPERFECT(k) THEN

MSGBOX(k+" is perfect, press OK");

END;

END;

END;

REPEAT Syntax: REPEAT commands UNTIL test;

Repeats the sequence of commands until test is true (not 0).

The example below prompts for a positive value for SIDES, modifying an earlier program in this chapter:

EXPORT SIDES; EXPORT GETSIDES() BEGIN

REPEAT

INPUT(SIDES,"Die Sides","N = ","Enter num sides",2);

UNTIL SIDES>0; END;

BREAK Syntax: BREAK(n)

Exits from loops by breaking out of n loop levels. Execution picks up with the first statement after the loop. With no argument, exits from a single loop.

CONTINUE Syntax: CONTINUE

Transfers execution to the start of the next iteration of a loop

532

Programming in HP PPL

Page 538
Image 538
HP Prime Graphing NW280AAABA manual +1 d END Return sum==n END, Export Perfectnums Begin, Until SIDES0 END