Variables - Casio FX-890P Owner's Manual

Casio personal computer owner's manual
Table of Contents

Advertisement

5.7.2 Variables

Numeric Variables
The following shows the numeric variables included in the sample program on page
33:
PROGRAM
20 R=15
30 INPUT "H=";H
40 V=PI*R^2*H
Numeric variables are so named because their contents are handled as numbers.
Numeric variable names can be up to 15 characters long, and are used within
programs to store calculation results or constants in memory. In the sample program,
the value 15 is stored in H, while V, which is the result of the calculation, holds the
value that represents the volume of the cylinder. As can be seen, assignment to a
variable is performed using the "=" symbol. This differs from an equal sign in that it
declares that what is to the right should be assigned to what is to the left. Actually, a
variable can be thought as a kind of box as illustrated below.
V
String Variables
Another type of variable is known as a string variable, which is used to store
character string data. String variable names are indicated by "$" following the name.
EXAMPLE:
10 A$="AD"
20 INPUT "YEAR=";B$
30 C$=A$+B$
40 PRINT C$
50 END
In the above program example, entering a year such as 1990 in line 20 results in a
display of AD1990 in line 40.
Note: Strings cannot be assigned to numeric variables such as A, and numeric
values cannot be assigned to string variables such as A$.
Array Variables
Both numeric variables and string variables can store only one data item per variable.
Because of this, large amounts of data are better-handled using array variables
(usually referred to as simply "arrays"). Before an array variable can be used within a
program, a DIM statement must appear at the beginning of the program to "declare"
to the computer that an array variable is to be employed.
NUMERIC VARIABLES
R
H
V
PI*R^2*H
Assigns "AD" to string variable A$
Assigns keyboard input to variable B$
Assigns combination of A$ and B$ to C$
Displays contents of C$
15
R
38

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Z-1grZ-1

Table of Contents