Click or drag to resize

Sign Function

X#
Returns a numeric value of 1, –1, or 0 if the specified numeric expression evaluates to a positive, negative, or 0 value.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.21
Syntax
 FUNCTION Sign(
	nExpression AS USUAL
) AS LONG
Request Example View Source

Parameters

nExpression
Type: Usual
Specifies the numeric expression Sign( ) evaluates. Sign( ) returns 1 if nExpression evaluates to a positive number, –1 if nExpression evaluates to a negative number, and 0 if nExpression evaluates to 0.

Return Value

Type: Long
Numeric
Examples
X#
1STORE 10 TO gnNum1
2STORE -10 TO gnNum2
3STORE 0 TO gnZero
4CLEAR
5? Sign(gnNum1)  // Displays 1
6? Sign(gnNum2)  // Displays -1
7? Sign(gnZero)  // Displays 0
See Also