I
rows. If your line is longer than one row, your Commodore 16 lets it
spill over to the next row Your computer considers the line ended
when you press the
anon
key, not when you type to the end of the
row. You'll gel used to this as you use your Commodore 16.
USING VARIABLES
The example 36*(12+(A/3)) shows one of the most powerful features
of a computer. When you have a letter instead of a number in a
mathematical problem, you're using a VARIABLE. A variable
represents a value:
10 A = 3
20 PRINT "TOTAL' ;A • 4
II you RUN this program, the screen result is.
TOTAL: 12
There are three types of variables you can use
TYPE
SAMPLE
SYMBOL DESCRIPTION EXAMPLES VALUES
Floating
point
real (decimal)
or whole
numbers
X. AB, T4
23.5, 12.
1.3E+2
Integer
%
whole numbers X %. Al %
15, 102, 3
Text string
S
letters.
numbers,
and all other
characters in
quotes
XS. MS$
"TOTAL",
"DAY 1", "CBM"
Make sure that you always use the right variable type. II you try to do
something like assign a word to an integer variable. your program won't
work. This program shows you what variable can or can't be used in a
given s'tuation, and you can find out what happens when you try out
different types of data
10 PRINT "ENTER A NUMBER"
this asks you to enter
a number for the
20 INPUT X%
variable
30
PRINT "I READ YOUR NUMBER AS"; X%
40 PRINT "NICE GOING, ACE!"
50 END
When you RUN this program, try to enter these values (one each time
you RUN it) when you're asked and see what happens
ONE FIFTH
043
10
NUMERIC FUNCTIONS
incuaeo at your computer s BASIC language are numeric functions.
which are like the advanced calculations found on most scientific
calculators (such as sine. cosine, tangent, etc.)
Most of the functions can be used by typing tne name of the function
and the number to be operated by the formula in parentheses. like this
.
I
I
I
so
I
' I
I
61
Every time you want a variable to be read as a whole number, the
symbol for that variable would include the % sign. A variable that
contains text MUST end with a $ as part of the variable. If It doesn't
have that symbol, your computer expects a floating point number. A
variable without either of the symbols (% or $) is read as a floating point
number (a "regular" number). Integer variables (whole numbers) are a
subset of floating point variables: they are numbers with no cecimat
places.
FUNCTION(X)
For example, to find out the sire of a variable you would type
PRINT SIN(X)
with X as any number you want to input.
Need help?
Do you have a question about the Commodore 16 and is the answer not in the manual?
Questions and answers