Atari 130XE — 130XE Owners Manual_Page_051

space after the N of ON or forgot the period and the space before TOO BAD!. Those spaces are important. Practice with another string variable input: .170 PRINT "BV THE HAV .. HHAT IS YOUR NAME"; .180 INPUT NAME$ 30 DIM NAME$ (.1) HOH MUCH YOU HON. FIRST YOU HAVE TO ANSHER A QUESTION. " .1 ~o PRINT" HELL .. "; NAME$;" .. I BET YOU HOULD LIKE TO KNOH Run the program. Even though you typed in a fu ll name, the computer printed only the first initial. That happened because the area dimensioned in RAM memory for the name was too small . Most people's names are longer than one character. Change line 30 to a more reasonable number of spaces and run the program :

30 DIM NAME$ (25) RUN Inputting Numeric Variables So far you have been working with alphanumeric string variables- variabl es composed of letters, numbers, or both. For instance, the computer would accept the name R2-D2 or 007 as a string variable. However, the number name would be used only as a name, not as a number in any math problems. Now try some numeric variables that can be used in mathematical calculations. Numeric variables do not need a DIM command or a do ll ar sign. Enter the following program lines: 200 PRINT: PRINT "HOH OLD ARE VOU"; 2.10 INPUT AGE 220 PRIZE=AGE*.1000 230 PRINT: PRINT "VOU HAVE JUST HON $".: PRIZE;" FROM THE LOTTERV. YOU CAN COLLECT DURING OFFICE HOURS.

" In this program, t he age that you enter is stored in the numeric variable called AGE. Line 220 creates another variable called PRIZE. Line 220 allows the computer's built-in calculator to calculate the prize money, which is $1000 multiplied by the age of the winner. (To the computer, * means multiply.) The program does the math for you and stores the answer in PRIZE. Line 230, which places the numeric value in side the PRINT statement in the same manner as string variables, tells you what the answer is. 45