EasyManua.ls Logo

Radio Shack TRS-80 Model 4 - Page 156

Radio Shack TRS-80 Model 4
418 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Ways of Representing Data
Constants
Variables
How BASIC Stores Data
Numeric (integer, single precision, double precision)
String
How BASIC Classifies Constants
How BASIC Classifies Variables
How BASIC Converts Data
Ways
of
Representing
Data
BASIC recognizes data
in
two forms: directly (as constants), or by
reference to a memory location (as variables).
Constants
All data
is
input into a program
as
"constants" - values which are
not subject to change. For example, the statement:
PRINT
"1
PLUS
1 EQUALS"; 2
contains one string constant
(1
PLUS 1 EQUALS), and one numeric
constant (2).
In
these examples, the constants "input" to the PRINT statement.
They tell PRINT what data to print on the display.
These are more examples of constants:
3.14159
1.775E+3
"NAME TITLE"
57
"L.O.SMITH"
"0123456789ABCDEF"
-123.45E
- 8
"AGE"
Variables
A variable
is
a place
in
memory where data
is
stored. Unlike a
constant, a variable's value can change. This allows you to write
programs dealing with changing quantities. For example,
in
the
statement:
A$
=
"OCCUPATION"
The variable A$ now contains the data OCCUPATION. However, if
this statement appeared later
in
the program:
A$
= "FINANCE"
The variable A$ would no longer contain OCCUPATION.
It
would now
contain the data FINANCE.
Variables can also store numeric values. For example:
A =
134
2-28

Other manuals for Radio Shack TRS-80 Model 4

Related product manuals