# Swift Double isLessThanOrEqualTo()

In this tutorial, we will learn about the Swift Double isLessThanOrEqualTo() method with the help of examples.

The `isLessThanOrEqualTo()` method checks if one number is less than or equal to another or not.

### Example

``````// check if 10 is less than or equal to 10 or not
var result = 10.isLessThanOrEqualTo(10)

print(result)

// Output: true``````

## isLessThanOrEqualTo() Syntax

The syntax of the `isLessThanOrEqualTo()` method is:

``num.isLessThanOrEqualTo(otherNumber)``

Here, `num` is a number.

## isLessThanOrEqualTo() Parameters

The `isLessThanOrEqualTo()` method takes one parameter

• `otherNumber` - the value to test

## isLessThanOrEqualTo() Return Values

The `isLessThanOrEqualTo()` method returns boolean value

• `true` - if `num` is less than or equal to `otherNumber`
• `false` - if `num` is greater than `otherNumber`

## Example 1: Swift Double isLessThanOrEqualTo()

``````// check if 4 is less than or equal to 2 or not
var result1 = 4.isLessThanOrEqualTo(2)
print(result1)

// check if 2.0 is less than or equal to 2 or not
var result2 = 2.0.isLessThanOrEqualTo(2)
print(result2)``````

Output

```false
true```

Here, since 4 is not less than or equal to 2, the `isLessThanOrEqualTo()` method returns `false`. However, 2.0 is equal to 2, the method returns `true`.

## Example 2: Using if…else With isLessThanOrEqualTo()

``````// check if 100 is less than or equal to 90 or not
if 100.isLessThanOrEqualTo(90) {
print("The condition is true")
}

else {
print("The condition is false")
}``````

Output

```
The condition is false```

Here, since 100 is less than or equal to 90, the condition is false so the code inside the `else` block is executed.