Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

VBScript Sgn Function

VBScript Sgn Function


VBScript reference manual Complete VBScript Reference Manual


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

Syntax

Sgn(number)

Parameters Description
number Required. A valid numeric expression.

If the number is:

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

    Example

    Example

    The example above produces the following output:

    1

    -1

    0

    Try it »


    VBScript reference manual Complete VBScript Reference Manual