Tandy 1000 Basic Reference Manual page 307

Hide thumbs Also See for 1000:
Table of Contents

Advertisement

Chapter
10 I
BASIC Keywords
SGN
Function
S GN( num
her)
Determines
number's
sign.
If
number
is a negative number, SGN returns -1.
If
number
is a positive number, SGN returns 1.
If
number
is zero, SGN returns 0.
Examples
Y
=
SGN<A
* E)
determines the sign of the expression A
*
B,
and passes the ap-
propriate number (-1,0,1) t o
Y.
Sample Program
6 1 0 I N P U T "ENTER
A NUMBER";
X
6 2 0 ON SGNCX)
+
2 GOT0 6 3 0 , 6 4 0 , 6 5 0
6 3 0 P R I N T " N E G A T I V E " :
END
6 5 0 P R I N T " P O S I T I V E " :
END
6 4 0 PRINT
" Z E R O - :
END
305

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents