From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!
Global Method

Sign(value As Double) As Integer

Supported for all project types and targets.

Returns the sign of the number passed to it.


result=Sign (value)

Part Type Description
result Integer The sign of value. Returns -1 if value is negative, 0 if value is zero, and 1 if value is positive.

If you pass a string or some other incorrect data type, result is 0.

value Double The number being passed to the function.


The following example determines the sign of the number passed to it.

Var result As Integer
If TextField1.Value <> "" Then
result = Sign(TextField.Value).ToInteger)
MessageBox("Please enter a number!")
End If

See Also

Abs function.