Chapter 3. Data
VARIABLES
You can store data in the 5100 by assigning it to a variable name. These stored
items &re called variables. Whenever the variable name is used, APL supplies the
data associated with that name. A
variable name can be up to 77 characters in
length with no blanks; the first character must be alphabetic and the remaining
characters can be
any combination of alphabetic and numeric characters. Variable
names longer than 77 characters can be used, but only the first 77 characters are
significant to APL. The + (assignment arrow) is used to assign data to a variable:
To display the value of a variable, enter just the variable name:
I.., 1, N G 'I' H
w 1: D 7' ki
AREA
b
8
1.1.8
DATA R
QPR ESENTATION
Numbers
The decimal digits 0 through 9 and the decimal point are used in the usual way. The
character -, called the negative sign, is used to denote negative numbers. It appears
as the leftmost character in the representation of any number whose value is less
than zero:
-
The negative sign, , is distinct from - (the symbol used to denote subtraction) and
can be used only as part of the numeric constant.
30
I
i
Scaled Representation (Scientific Notation)
You can represent numbers by stating a value in some convenient range, then mul-
tiplying it by the appropriate power of ten. This type of notation is called scaled
representation in APL. The form of a scaled number is a number (multiplier) followed
by E and then an integer (the scale) representing the appropriate power of 10. For
example:
Number
66700
.00284
Scaled Form
6.67E4
2.84 E 3
t- Multiplier
- Scale
The E (E can be read times ten to the) in the middle indicates that this is scaled form;
the digits to the right of the E indicate the number of places that the decimal point
must be shifted. There can be no spaces between the E and the numbers on either
side of it.
Character Constants
Zero or more characters enclosed in single quotes, including overstruck characters
(see Appendix B) and blank characters (spaces), is a character constant. The quotes
indicate that the characters keyed do not represent numbers, variable names, or
functions, but represent only themselves. When character constants are displayed,
the enclosing quotes are not shown:
When a quote is required within the character constant, a pair of quotes must be
entered to produce the single quote in the character constant. For example:
' UON' "I' GIVE: Tlili': ANSWEli AWAY '
DON'T cxvti: THE ANSWER AWAY
31
Previous Page Next Page