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.
Sintakse:
Sgn (Skaitlis)
Atgrieztā vērtība:
Vesels skaitlis
Parametri:
Skaitlis: skaitliska izteiksme, kura nosaka funkcijas atgriezto vērtību.
NumExpression |
Atgrieztā vērtība |
negatīvs |
Sgn atgriež -1. |
0 |
Sgn atgriež 0. |
pozitīvs |
Sgn atgriež 1. |
Piemērs:
Sub ExampleSgn
Print sgn(-10) ' atgriež -1
Print sgn(0) ' atgriež 0
Print sgn(10) ' atgriež 1
End Sub