Method

Sign


Description

Returns the Sign of the number passed to it.

Usage

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.

value

Double

The number being passed to the function.

Sample code

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

Var result As Integer
If Not TextField1.Text.IsEmpty Then
  result = Sign(TextField1.Text.ToDouble)
  MessageBox(result.ToString)
Else
  MessageBox("Please enter a number!")
End If

Compatibility

All project types on all supported operating systems.

See also

Abs function.