Skip to content

Sgn - Built-in Arithmetic Function

Purpose

Sgn returns an integer indicating the sign of a number.

Syntax

Sgn(num)

Arguments

Argument Required Description
num Yes Any numeric expression.

Returns

Integer

num Returned value
Greater than zero 1
Zero 0
Less than zero -1

Example

Return Sgn(-3) // returns -1

Notes

  • When num cannot be converted to a number, a runtime error is generated.