EasyManua.ls Logo

Laser 128 - Sgn

Laser 128
255 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...
BASIC
FUNCTIONS
4.12
SGN
Purpose
:
To
return
the
sign
of
a
number.
Format
:
SGN
(x )
Comme
n
ts
:
If
the
number
is
greater
than
zero,
then
SGN
returns
1;
if
it
is
zero,
SGN
returns
zero;
and
if
it
is
nega
tiv
_e,
then
SGN
returns
-1.
Example
: ]
10
INPUT
A
] 20 B =
SGN
(A)
] 30
IF
B = 0
THEN
90
] 40
IF
B > 0
THEN
70
] 50
PRINT
"A IS
NEGATIVE"
] 60
GOTO
10
] 70
PRINT
"A IS
POSITIVE"
] 80
GOTO
10
] 90
PRINT
"A IS
ZERO"
] 100
GOTO
10
]RUN
? 1
A IS
POSIT
I
VE
? -4
A IS
NEGATIVE
? 0
A IS
ZERO
?
II-117

Table of Contents