10-2 Programming
Getting Started is a fast-paced introduction. Read the chapter for details.
A program is a set of commands that can be executed sequentially, as if they
had been entered from the keyboard. Write a simple program to simulate the
rolling of a single die. It should prompt for the number of rolls and then store the
results of the rolls in a list.
1. Press K 9 9 to display the PRGM NEW menu.
2. Press ¸ to select CREATE NEW. (The keyboard
is now in ALPHA-LOCK.) Type R O L L as the name
of the program, and press ¸. You are now in the
program editor. The : (colon) in the first column of
the second line indicates that this is the beginning of
a command line.
3. Press K 9 to access the PRGM I/O menu. Press
4. CLRHOME is copied to cursor location. Press
¸ to complete the instruction and move to the
next line.
4. Press 0 § 2 = 3 2 ¢. This sets the
dimension of Lã (the list where the results of the rolls
will be stored) to 0. Press ¸ to complete the
instruction and move to the next line.
5. Press K 9 1 to copy INPUT to the cursor
location. Press 2 < ã"ä ROLLS 2 D 1
? ã"ä b ? R to prompt the user to input the
number of rolls. Press ¸ to complete the
instruction.
6. Press K 4 to copy FOR( to the cursor location.
Press ? I b 1 b ? R b 1 d. Press ¸
to complete the instruction.
Getting Started: Rolling a Die