Method: Sgn for VBS
- Updated2024-09-12
- 1 minute(s) read
Methods > Method: Sgn for VBS
Method: Sgn for VBS
Specifies the sign of a number.
vSgn = Object.Sgn(number)
| Object | VBS Object with this method. You do not need to specify this object. |
| number | Variant Specifies a numeric value. |
| vSgn | Variant Receives the sign of number. The value is -1 for negative values, 0 for the value 0, and 1 for positive values. |
The following example specifies the sign of various numbers:
Call MsgBox(Sgn(99.2)) ' Returns 1 Call MsgBox(Sgn(-99.8)) ' Returns -1 Call MsgBox(Sgn(0)) ' Returns 0