Program:

Comments:

 

 

"ADD A NAME"

Creates an input form that gets

{

the name and phone number.

{ "NAME:" "ENTER NAME" 2 }

The two fields accept only

{ "PHONE:" "ENTER A PHONE

strings (object type 2).

NUMBER" 2 } }

 

{ } { } { } INFORM

 

REPEAT

 

DUP

Checks if either field in the

IF { NOVAL } HEAD POS

new entry is blank.

THEN

 

DROP

If either one is, displays a

"Complete both fields

message.

before pressing OK"

 

MSGBOX

 

ELSE 1

If neither are, adds the list to

→LIST NAMES + SORT

NAMES, sorts it, and stores it

'NAMES' STO

back in NAMES.

END

Ends the IF structure, the

END

WHILE loop, and the CASE

END

statement.

c 2 ==

Case 2 (View a Number).

THEN

Checks if NAMES is an empty

IF { } NAMES SAME

list.

THEN

 

"YOU MUST ADD A NAME FIRST"

If it is, displays a message.

MSGBOX

 

ELSE

If NAMES isn’t empty, creates

WHILE

a choose box using NAMES as

"VIEW A NUMBER"

choice items.

NAMES 1 CHOOSE

 

REPEAT

When OK is pressed, the

→STR MSGBOX

second item in the NAMES

 

list pairs (the phone number) is

 

returned. Makes it a string and

 

displays it.

END

Ends the WHILE loop, the IF

END

structure, and the CASE

END

statement.

END

Ends the CASE structure,

»

marks the end of the local

END

variable defining procedure,

»

ends the WHILE loop, and

 

 

marks the end the program.

 

 

`OPHONES

Stores the program in

 

PHONES.

 

 

RPL Programming 1-47