Sharp OZ-707 Operation Manual - Page 23

Enter

Page 23 highlights

B $1 ENTER I B$ BYTE The contents of character strings or character variables are displayed from the left edge of the next line. Variables handled by the Card are divided into the following: Variables Numeric variables: Fixed numeric variables (A to Z) Simple numeric variables (AB, C1, etc.) Numeric array variables String variables: Simple string variables (A$, BB$, C2$, etc.) String array variables Numeric variables are further divided into single-precision and double-precision variables. These will be discussed later. Fixed Numeric Variables The first type, fixed numeric variables, are always used by the Card for storing numerical data. They can be thought of as pre-allocated variables. In other words, no matter how much memory your program uses, you will always have at least 26 variables to choose from to store numerical data in. Fixed memory locations are eight bytes long. Simple Variables Simple variable names are specified by alphanumeric characters, such as AB, B$, C8$. Unlike fixed variables, simple variables have no dedicated storage area in memory. The area for simple variables is automatically set aside (within the program and data area) when a simple variable is first used. Since separate memory areas are defined for simple numeric variables and simple string variables even if they have the same name, variables such as AB, AB$ and AB#, for example, may be used at the same time. 34 While alphanumeric characters are usable for simple variable names, the first character of a variable name must always be a letter. Up to 40 characters may be used to define a variable name. Notes: 1. Variable names must not begin with a BASIC command (e.g. PRINTOUT, ONPRINT), but may contain BASIC commands if desired (e.g. APRINT, BONPRINT). 2. Each simple string variable can hold up to 254 characters or symbols. Array Variables Sometimes, it is useful to deal with numbers as an organized group, such as a list of scores or a tax table. In BASIC these groups are called arrays. Arrays can be one-dimensional, like a list, two-dimensional, like a table, or multi-dimensional up to 120 dimensions. Use the DIM (short for dimension) statement to define an array. Arrays must always be declared before they are used (unlike the single-value variables we have been using). The form for the DIMension statement is: DIM array-variable-name (size) where: array-variable-name is a variable that conforms to the normal rules for numeric or array variable names previously discussed. size is the number of storage locations. Note that when you specify a number for the size, you get one more location than you specified. Examples of legal numeric and string DIMension statements are: DIM X(5) DIM AA(24) DIM QUITE5(0} DIM X$(S) DIM AA$(24) DIM QUITES$(O) ~ X (0), X (1), X (2), X (3), X (4), X (5) 35

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128

B
$1
ENTER
I
B$
BYTE
The contents
of
character strings
or
character variables
are
displayed
from the left
edge
of the next
line.
Variables handled
by
the
Card
are
divided into
the
following:
Variables
Numeric variables:
Fixed
numeric variables
(A
to
Z)
Simple numeric variables (AB,
C1,
etc.)
Numeric array variables
String variables:
Simple string variables
(A$,
BB$,
C2$,
etc.)
String array variables
Numeric variables are further divided into single-precision and
double-precision variables.
These
will
be
discussed later.
Fixed Numeric Variables
The first type, fixed numeric variables, are always used
by
the
Card
for
storing numerical data. They
can
be
thought of
as
pre-allocated
variables.
In
other words,
no
matter how
much
memory
your program
uses,
you
will always have
at
least 26 variables
to
choose from
to
store numerical data
in.
Fixed
memory locations
are
eight bytes
long.
Simple Variables
Simple variable names
are
specified by alphanumeric characters,
such
as
AB,
B$,
C8$.
Unlike fixed variables, simple variables have
no
dedicated storage area
in
memory.
The area for simple variables
is
automatically set aside (within
the
program
and
data
area)
when a
simple variable
is
first used.
Since separate memory areas
are
defined for simple numeric variables
and simple string variables
even
if
they have
the
same
name, variables
such
as
AB,
AB$
and
AB#,
for example,
may
be
used
at the
same
time.
34
While alphanumeric characters
are
usable for simple variable names,
the
first character
of
a variable
name
must always
be
a letter. Up
to
40
characters may
be
used to define a variable name.
Notes:
1.
Variable
names
must not begin with a BASIC command (e.g.
PRINTOUT, ONPRINT), but
may
contain BASIC commands if
desired
(e.g.
APRINT, BONPRINT).
2.
Each simple string variable
can
hold
up
to 254 characters or
symbols.
Array Variables
Sometimes,
it
is
useful to deal with numbers
as
an organized group,
such
as a list
of
scores or a tax table.
In
BASIC these groups are
called arrays. Arrays can
be
one-dimensional, like a list,
two-dimensional, like a table, or multi-dimensional
up
to
120
dimensions.
Use
the
DIM
(short for dimension) statement
to
define
an
array. Arrays
must always
be
declared before they
are
used (unlike
the
single-value
variables
we
have
been
using).
The
form
for the DIMension statement
is:
DIM array-variable-name (size)
where:
array-variable-name
is
a variable that conforms
to
the
normal
rules for numeric or array variable names previously discussed.
size is
the
number of storage locations. Note that when you
specify a number for the
size,
you
get one more location than
you
specified.
Examples of legal numeric and string DIMension statements are:
DIM
X(5)
DIM
AA(24)
DIM
QUITE5(0}
DIM
X$(S)
DIM
AA$(24)
DIM
QUITES$(O)
~
X
(0),
X
(1),
X
(2),
X
(3),
X
(4),
X
(5)
35