(The in the previous program is the calculator’s representation for the newline character after you enter a program on the stack.)

Using INPUT, ENTER for Input

INPUT lets you use the stack area for prompting, lets you supply default input, and prevents the user from using normal stack operations or altering data on the stack.

To enter INPUT in a program:

1.Enter a string (with "" delimiters) to be displayed as a prompt at the top of the stack area.

2.Enter a string or list (with delimiters) that specifies the commandline content and behavior — see be low.

3.Enter the INPUT command (PRG IN menu).

4.Enter OBJ→ (PRG TYPE menu) or other command that processes the input as a string object.

«"promptstring " "commandline " INPUT OBJ→ »

or

«"promptstring " {commandline " INPUT OBJ→ »

INPUT, in its simplest form, takes two strings as arguments — see the list of additional options following. INPUT blanks the stack area, displays the contents of the level2 string at the top of the stack area, and d isplays the contents of the level1 string in the command line. It then activates Programentry mode, puts the insert curso r after the string in the command line, and suspends execution.

When execution resumes, the input is returned to level 1 as a string object, called the result string.

To respond to INPUT while running a program

1.Enter your input. (You can’t execute commands — they’re simply echoed in the command line.)

2.Optional: To clear the command line and start over, press .

3.Press `.

If you execute this program segment

«"Variable name?" ":VAR:" INPUT » the display looks like this:

140 RPL Programming

Page 64
Image 64
HP 50g Graphing Using INPUT, Enter for Input, To enter Input in a program, « … promptstring commandline Input OBJ→ … »