Please note, this is a STATIC archive of website www.w3schools.com from 05 May 2020, cach3.com does not collect or store any user information, there is no "phishing" involved.
THE WORLD'S LARGEST WEB DEVELOPER SITE

VBScript Sgn Function


❮ Complete VBScript Reference

The Sgn function returns an integer that indicates the sign of a specified number.

Syntax

Sgn(number)

Parameter Description
number Required. A valid numeric expression

If number is:

  • >0 - Sgn returns 1
  • =0 - Sgn returns 0
  • <0 - Sgn returns -1

Example

Example

<%

response.write(Sgn(15) & "<br />")
response.write(Sgn(-5.67) & "<br />")
response.write(Sgn(0))

%>

The output of the code above will be:

1
-1
0
Show Example »

❮ Complete VBScript Reference