Line 10 tells the computer to save enough space in its memory for an answer that is a maximum of 100 characters. The variable in this program has been named ANSWER. The variable is going to store letters and numbers, so it is a string variable. String variables are designated by a dollar sign after the last letter of the variable name. Line 130 allows you to enter an answer. When you run the program, the computer displays the question on the screen, and you then type in your answer. That answer is stored in the string variable called ANSWER$. If the DIM statement, line 10 , was omitted, an Error message would occur, and the INPUT statement wouldn 't work. ?:
Courtesy of INPUT Run the program again. Two question marks will appear on the screen. The second question mark will be on the line next to the left margin. List your program and notice that you typed only one question mark in the program. The INPUT command always puts a question mark on the screen for you. Type the variation of line 120 below: Run the program and type in your response when the computer asks its question. Now only one question mark appears, and your answer immediately follows the question on the same line. Create some more dialogue by dimensioning more string variables and inserting more I N- PUT statements. The DIM statements should be at the beginning of the program:
20 DIM DATE$ (25) 1.40 PRINT: PRINT "WHEN WOULD YOU LIKE TO COME AND PICK UP YOUR PRIZE"; 1.50 INPUT DATE$ RUN String Variables in PRINT Statements The computer program now asks two questions but doesn't respond to your last answer. To get a response, you can place the string variable in the PRINT statement in the following way: 1.60 PRINT" I' M SORRV .. BUT OUR OFFICES ARE ALWAVS CLOSED ON ";DATE$;". TOO BAD!" The semicolon glues the string variable between two phrases in quotation marks. Run the program. If the words are not spaced correctly, compare your line to the line abov e. You probably left out a 44