| 1 |
--- |
| 2 |
title: compare.Le |
| 3 |
description: Returns the boolean truth of arg1 <= arg2 && arg1 <= arg3. |
| 4 |
categories: [] |
| 5 |
keywords: [] |
| 6 |
params: |
| 7 |
functions_and_methods: |
| 8 |
aliases: [le] |
| 9 |
returnType: bool |
| 10 |
signatures: ['compare.Le ARG1 ARG2 [ARG...]'] |
| 11 |
aliases: [/functions/le] |
| 12 |
--- |
| 13 |
|
| 14 |
```go-html-template |
| 15 |
{{ le 1 1 }} → true |
| 16 |
{{ le 1 2 }} → true |
| 17 |
{{ le 2 1 }} → false |
| 18 |
|
| 19 |
{{ le 1 1 1 }} → true |
| 20 |
{{ le 1 1 2 }} → true |
| 21 |
{{ le 1 2 1 }} → true |
| 22 |
{{ le 1 2 2 }} → true |
| 23 |
|
| 24 |
{{ le 2 1 1 }} → false |
| 25 |
{{ le 2 1 2 }} → false |
| 26 |
{{ le 2 2 1 }} → false |
| 27 |
``` |
| 28 |
|
| 29 |
Use the `compare.Le` function to compare other data types as well: |
| 30 |
|
| 31 |
```go-html-template |
| 32 |
{{ le "ab" "a" }} → false |
| 33 |
{{ le time.Now (time.AsTime "1964-12-30") }} → false |
| 34 |
{{ le true false }} → false |
| 35 |
``` |