Skip to content

dos_sign

Dale Fugier edited this page Nov 6, 2023 · 1 revision

Returns a value indicating the sign of a number, or an expression based on the sign of a value.

Syntax

(dos_sign number [expr1 expr2 expr3])

Parameters

number

The number.

expr1

The first expression.

expr2

The second expression.

expr3

The third expression.

Returns

If optional expressions are not specified, then -1 if number is less than zero, 0 if number is equal to zero, or 1 if number is greater than zero, if successful.

If optional expressions are specified, then expr1 if number is less than zero, expr2if number is equal to zero, or expr3 if number is greater than zero, if successful.

nil on error.

Example

Command: (dos_sign -3.14)
-1
Command: (dos_sign 0.0)
0
Command: (dos_sign 3.14)
1
Command: (dos_sign 3.14 "Less Than" '(2 3) 5.67)
5.67
Clone this wiki locally