Funzione Sgn

Restituisce un numero intero compreso tra -1 e 1 che indica se il numero passato alla funzione è positivo, negativo o zero.

Sintassi:

Sgn (Numero)

Valore restituito:

Integer

Parametri:

Numero: espressione numerica che determina il valore restituito dalla funzione.

EspressioneNum

Valore restituito

negativo

Sgn restituisce -1.

0

Sgn restituisce 0.

positivo

Sgn restituisce 1.


Codici di errore:

5 Richiamo di procedura non valido

Esempio:

Sub ExampleSgn

    Print sgn(-10) ' restituisce -1

    Print sgn(0) ' restituisce 0

    Print sgn(10) ' restituisce 1

End Sub