HUGO
Menu
GitHub 89864 stars Mastodon

compare.Gt

Reports whether the first argument is greater than all of the subsequent arguments.
Syntax
compare.Gt ARG1 ARG2 [ARG...]
Returns
bool
Alias
gt

Usage

The compare.Gt function reports whether the first argument is greater 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.Gt 1 1 }} → false
{{ compare.Gt 1 2 }} → false
{{ compare.Gt 2 1 }} → true

{{ compare.Gt 1 1 1 }} → false
{{ compare.Gt 1 1 2 }} → false
{{ compare.Gt 1 2 1 }} → false
{{ compare.Gt 1 2 2 }} → false

{{ compare.Gt 2 1 1 }} → true
{{ compare.Gt 2 1 2 }} → false
{{ compare.Gt 2 2 1 }} → false

Comparing numbers of different types:

{{ compare.Gt 1 1.0 }} → false

Comparing other data types:

{{ compare.Gt "ab" "a" }} → true
{{ compare.Gt time.Now (time.AsTime "1964-12-30") }} → true
{{ compare.Gt true false }} → true