compare.Le
Reports whether the first argument is less than or equal to all of the subsequent arguments.
- Syntax
- compare.Le ARG1 ARG2 [ARG...]
- Returns
- bool
- Alias
- le
Usage
The compare.Le function reports whether the first argument is less than or equal to all of the subsequent arguments. Numbers are compared by value, regardless of type. You can also use this function to compare strings, boolean values, dates, and other comparable data types.
Examples
{{ compare.Le 1 1 }} → true
{{ compare.Le 1 2 }} → true
{{ compare.Le 2 1 }} → false
{{ compare.Le 1 1 1 }} → true
{{ compare.Le 1 1 2 }} → true
{{ compare.Le 1 2 1 }} → true
{{ compare.Le 1 2 2 }} → true
{{ compare.Le 2 1 1 }} → false
{{ compare.Le 2 1 2 }} → false
{{ compare.Le 2 2 1 }} → falseComparing numbers of different types:
{{ compare.Le 1 1.0 }} → trueComparing other data types:
{{ compare.Le "ab" "a" }} → false
{{ compare.Le now (time "1964-12-30") }} → false
{{ compare.Le true false }} → falseLast updated:
November 8, 2026
:
content: Remove categories from front matter (1cc1dd83a)
Improve this page