EasyManua.ls Logo

Commodore 128D - Basic Functions; What Is a Function; The INTEGER Function (INT)

Commodore 128D
427 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...
p.
n
Basic
Functions
i
\
n
Guide
for
a
complete
memory
map
of
the
computer,
which
shows
you
the
contents
of
all
memory
locations.
What
Is
a
Function?
A
function
is
a
predefined
operation
of
the
BASIC
language
that
gen
erally
provides
you
with
a
single
value.
When
the
function
provides
the
value,
it
is
said
to
"return"
the
value.
For
instance,
the
SQR
(square
root)
function
is
a mathematical
function
that
returns
the
root
value
of
a
specific
number
before
it
is
raised
to
the
second
power—i.e.,
the
value
returned
when
multiplied
by
itself
(squared)
is
equal
to
the
argument
used
in
the
function.
There
are
two
kinds
of
functions:
Numeric—returns
a
result
which
is
a
single
number.
Numeric
functions
range
from
calculating
mathematical
values
to
speci
fying
the
numeric
value
of
a
memory
location.
String—returns
a
result
which
is
a
character.
Following
are
descriptions
of
some
of
the
more
commonly
used
functions.
For
a complete
list
of
BASIC
7.0
functions
see
Chapter
V,
BASIC
7.0
Encyclopedia.
The
INTEGER
Function
(INT)
What
if
you
want
to
round
off
a
number
to
the
nearest
integer?
You'll
need
to
use
INT,
the
integer
function.
The
INT
function
takes
away
everything
after
the
decimal
point.
Try
typing
these
examples:
?
INT(4.25)
?
INT(4.75)
?
INT(SQR(50))
If
you
want
to
round
off
to
the
nearest
whole
number,
then
the
sec
ond
example
should
return
a
value
of
5.
In
fact,
you
should
round
up
any
number
with
a
decimal
of
0.5
and
above.
To
do
this,
you
have
to
add
0.5
to
the
number
before
using
the
INT
function.
In
this
way,
numbers
with
decimal
portions
of
0.5
and
above
will
be
increased
by
1
before
being
rounded
down
by
the
INT
function.
Try
this:
?INT(4.75
+
0.5)i
67
USING
C128
MODE—Advanced
BASIC
Programming

Table of Contents

Other manuals for Commodore 128D

Related product manuals