EasyManua.ls Logo

Commodore Plus 4 - Page 143

Commodore Plus 4
234 pages
Print Icon
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...
—-
tain
any
of
the
following
characters:
SPACE,
colon,
or
comma.
If
two
commas
have
nothing
between
them,
the
value
will
be
READ
as a
zero
for
a
number,
or
an
empty
string.
Also
see
the
RESTORE
statement.
which
allows
the
Plus/4
to
re-read
data.
EXAMPLE:
DATA
100,
200,
FRED,
"HELLO,MOM'1,
,
3,
14,
ABC123
DEF
FN
DEF
FN
name
(Var/'ab/eJ
=
expression
(DEFine
FunctioN)
This
command
allows
you
to
define
a
complex
calculation
as
a
func-
tion.
In
the
case
of
a
long
formula
that
is
used
several
times
within
a
program,
this
can save
a
lot
of
space.
The
name
you
give
the
function
begins
with
the
letters
FN,
followed
by
any
legal
numeric
variable
name.
First
you
must
define
the
function
by
using
the
statement
DEF
followed
by
the
name
you
have
given
the
function.
Following
the
name
is
a
set
of
parentheses
{)
with
a
numeric
variable
(in
this
case,
X)
en
closed.
Then
you have
an
equal
sign,
followed
by
the
formula
you want
to
define.
You
can
"call"
the
formula,
substituting
any
number
for
X,
using
the format
shown
in
line
20
of
the
example
below:
EXAMPLE
10
DEF
FNA(X)
=
12*(34.75-X/.3)
+
X
20
PRINT
FNA(7)
The
number
7
is
in
serted
each
place X
is
located
in
the
for
mula
given
in
the
DEF
statement.
DIM
DIM
vanable
(subscripts)
\,vanable(subschp(s)]...
Before
you
can
use
an
array
of
variables,
the
program
must
first
exe
cute
a
DIM
statement
to
establish
the
DIMensions
of
that
array
(unless
there
are
11
or
fewer
elements
in
the
array).
The
statement
DIM
is
fol
lowed
by
the
name
of
the
array,
which
may
be
any
legal
variable
name.
Then,
enclosed
in
parentheses,
you
put
the
number
(or
numeric
vari-
able)
of
elements
in
each
dimension.
An
array
with
more
than
one
di
mension
is
called
a
matrix.
You
may
use any
number
of
dimensions,
but
keep
in
mind
that
the
whole
list
of
variables
you
are
creating
takes
up
space
in
memory,
and
it
is
easy
to
run
out
of
memory
if
you
get
car-
134

Other manuals for Commodore Plus 4

Related product manuals