When necessary, the CBM BASIC Interpreter will convert a numeric data item from an integer to floating-point. or vice-versa, according to the following rules:
Now that you know what variables are, let's take that information an put it together with the INPUT statement for some practical programming applications.
In our first example, you can think of a variable as a "storage compartment" where the Commodore 64 stores the user's response to your prompt question. To write a program which asks the user to type in a name, you might assign the variable N$ to the name typed in. Now every time you PRINT N$ in your program, the Commodore 64 will automatically PRINT the name that the user typed in.
Type the word NEW on your Commodore 64. Hit the <RETURN> key and try this example:
10 PRINT"YOUR NAME": INPUT N$ 20 PRINT"HELLO",N$
|This page has been created by Sami Rautiainen.|
|Read the small print.||Last updated November 14, 1998.|