Operator

Less than or equal


Description

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

Usage

result = expression1 <= expression2

Part

Type

Description

result

Boolean

Returns True if expression1 is less than or equal to expression2.

expression1

String, Number, or DateTime

Any alphabetic or quantitative expression.

expression2

String, Number, or DateTime

Any alphabetic or quantitative expression.

Notes

A string is "less than" another string if it is first 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

This example uses the <= operator to evaluate a and b.

Var a,b As Integer
If Not TextField1.Text.IsEmpty And Not TextField2.Text.IsEmpty Then
  a = TextField1.Text.ToInteger
  b = TextField2.Text.ToInteger
  If a <= b Then
    MessageBox("A is less than or equal to B!")
  Else
    System.Beep
  End If
Else
  MessageBox("Please enter values into both boxes!")
End If

Compatibility

All project types on all supported operating systems.

See also

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