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 for loop counts up if first < last
, and counts down if first > last
:
for x = first to last step sgn(last-first)
print x
next
See also
for; abs