< Futurebasic < Language < Reference
SGN
Syntax
signOfExpr = SGN(expr)
Description
Use this function to determine the "sign" of expr
. SGN
returns:
- 1 if expr is positive;
- 0 if expr is zero;
- -1 if expr is negative.
Example
This loop counts up if first, and counts down if last: <code><b>FOR</b> x = first <b>TO</b> last <b>STEP</b> <b>SGN</b>(last-first)<br> <b> PRINT</b> x<br> <b>NEXT</b></code>
See Also
FOR; ABS
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.