Sgn Function
Devolve un enteiro entre -1 e 1 que indica se o número pasado á función é positivo, negativo ou cero.
Sintaxe:
Sgn (Número)
Valor de retorno:
Enteiro
Parámetros:
Number: Numeric expression that determines the value that is returned by the function.
ExpresiónNum |
Return value |
negativo |
Sgn devolve -1. |
0 |
Sgn devolve 0. |
positivo |
Sgn devolve 1. |
Exemplo:
Sub ExampleSgn
Print sgn(-10) REM devolve -1
Print sgn(0) REM devolve 0
Print sgn(10) REM devolve 1
End Sub