Sgn Function

Returns an integer number between -1 and 1 that indicates if the number that is passed to the function is positive, negative, or zero.

Синтакса

Sgn (број)

Врати вредност:

Цел број

Параметри:

Number: Numeric expression that determines the value that is returned by the function.

Num Израз

Врати вредност

Негативно

Sgn returns -1.

0

Sgn returns 0.

Позитивно

Sgn returns 1.


Error codes:

5 Invalid procedure call

Пример

Sub ExampleSgn

    Print sgn(-10) REM returns -1

    Print sgn(0) REM returns 0

    Print sgn(10) REM returns 1

End Sub