Section 1.3---The "Input" Command
Section 1.3---The "Input" Command

Back

The next command is the input command. This is accessed by going to [PRGM][Right][ENTER]. It asks for a number or letters, and stores them to a variable. It looks like this:
Input "Whatever you want it to ask" , Whatever variable you want it to store the answer to
So, write a program that inputs two numbers, then adds the numbers together.
It should look like this:
:Input "A?",A
:Input "B?",B
:Disp A+B
And it should run like this:
A? 1
B? 1
2
If you wanted to add numbers into consecutive variables, then you could use the prompt command. This is accessed by [PRGM][Right][2]. Then You put the variables you want to ask and seperate them by a comma. The completed command would look like this:
:Prompt A,B,R
And the program would look like this when run:
A=? 1
B=? 2
R=? 3
That's all with the input command. Next, we'll learn about strings.
Section 1.4---Strings