compare.Lt
Reports whether the first argument is less than all of the subsequent arguments.
- Syntax
- compare.Lt ARG1 ARG2 [ARG...]
- Returns
- bool
- Alias
- lt
Usage
The compare.Lt function reports whether the first argument is less than 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.Lt 1 1 }} → false
{{ compare.Lt 1 2 }} → true
{{ compare.Lt 2 1 }} → false
{{ compare.Lt 1 1 1 }} → false
{{ compare.Lt 1 1 2 }} → false
{{ compare.Lt 1 2 1 }} → false
{{ compare.Lt 1 2 2 }} → true
{{ compare.Lt 2 1 1 }} → false
{{ compare.Lt 2 1 2 }} → false
{{ compare.Lt 2 2 1 }} → falseComparing numbers of different types:
{{ compare.Lt 1 1.0 }} → falseComparing other data types:
{{ compare.Lt "ab" "a" }} → false
{{ compare.Lt time.Now (time.AsTime "1964-12-30") }} → false
{{ compare.Lt true false }} → falseLast updated:
September 16, 2026
:
content: Draft standard for function and method pages (9a554d1fe)
Improve this page