Equinox Online Help - Language Reference - A to Z

Home

Sign

Applies to
SyntaxSign(NumberExpression)
Action[Function] Returns the sign of a number.
ScopeUsable anywhere.
Notes

This function returns 1 if NumberExpression is positive, 0 if it is zero, or -1 if it is negative

CategoryMaths
See Also Abs, Acos, Asin, Atan, Cos, Deg, Int, Log, Max, Min, MinMax, Rad, Rnd, RndStart, Round, Sin, Sqrt, Tan
Example

This example method determines how to display an account balance field on a form. If the account balance is negative, a red warning message is displayed; if the account has a zero balance, no text is displayed; if the account is in credit, a green message appears.

Switch Sign(AccountBalance)
case -1
Set text, "attention", "OVERDRAWN"
Set foreground, "attention", red
case 0
Set text, "attention", ""
case 1
Set text, "attention", "Credit"
Set foreground, "attention", green
end switch