Operator

# Less than or equal

<div class="rst-class">

forsearch

</div>

Operator

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

## Description

Used to determine whether one alphabetic or quantitative expression is smaller than or equal to another. `String</api/data_types/string>` comparisons are case-insensitive.

## Usage

``` xojo
result = expression1 <= expression2
```

| Part        | Type                                                                              | Description                                                                                 |
|-------------|-----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------|
| result      | `Boolean</api/data_types/boolean>`                                                | Returns `True</api/language/true>` if *expression1* is less than or equal to *expression2*. |
| expression1 | `String</api/data_types/string>`, Number, or `DateTime</api/data_types/datetime>` | Any alphabetic or quantitative expression.                                                  |
| expression2 | `String</api/data_types/string>`, Number, or `DateTime</api/data_types/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<string.compare>` to do a case-sensitive `string</api/data_types/string>` comparison.

You can use `Operator Compare</api/language/operators/operator_overloads/operator_compare>` to define comparisons for classes.

## Sample code

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

``` xojo
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

|                       |     |
|-----------------------|-----|
| **Project Types**     | All |
| **Operating Systems** | All |

<div class="seealso">

`\></api/language/operators/comparison/greater_than>`, `\>=</api/language/operators/comparison/greater_than_or_equal>`, `<</api/language/operators/comparison/less_than>`, `=</api/language/operators/comparison/equals_operator>`, `<></api/language/operators/comparison/not_equal>` operators; `Operator Compare</api/language/operators/operator_overloads/operator_compare>`, `String.Compare<string.compare>` functions; `Operator precedence</api/language/operators/operator_precedence>`.

</div>
