Module
Contents
Index 🔎︎

# 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.

## Sintaksis:

    Sgn (Angka)

## Nilai hasil:

Integer

## Parameter:

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

NumExpression | Nilai hasil
negative | Sgn menghasilkan -1.
0 | Sgn menghasilkan 0.
positive | Sgn menghasilkan 1.

## Kode kesalahan:

5 Tidak sah dalam pemanggilan prosedur

## Contoh:

    Sub ExampleSgn

        Print sgn(-10) REM menghasilkan -1

        Print sgn(0) REM menghasilkan 0

        Print sgn(10) REM menghasilkan 1

    End Sub