Operator

Greater than


Description

Used to determine whether one alphabetic or quantitative expression is larger than another. String comparisons are case-insensitive.

Usage

result = expression1 > expression2

Part

Type

Description

result

Boolean

Returns True if expression1 is larger than expression2.

expression1

String, Number, or DateTime

Any alphabetic or quantitative expression.

expression2

String, Number, or DateTime

Any alphabetic or quantitative expression.

Notes

The data types of expression1 and expression2 must match.

A string is "Greater than" another string if it is last when the two strings are sorted alphabetically. Use String.Compare to do a case-sensitive string comparison.

You can use Operator Compare to define comparisons for classes.

Sample code

The following sample code compares different values:

Var num1 As Integer = 100
Var num2 As Integer = 250

If num1 > num2 Then
  ' This block is skipped
Else
 ' This block is executed
End If

Var t1 As String = "Hello"
Var t2 As String = "World"

If t1 > t2 Then
  // This block is skipped
Else
  // This block is executed
End If

Compatibility

All project types on all supported operating systems.

See also

Greater than, >=, <, <=, =, <> operators; Operator Compare, String.Compare functions; Operator precedence.