HUGO
Menu
GitHub 90038 stars Mastodon

compare.Ne

Reports whether the first argument is not equal to any of the subsequent arguments.
Syntax
compare.Ne ARG1 ARG2 [ARG...]
Returns
bool
Alias
ne

Usage

The compare.Ne function reports whether the first argument is not equal to any 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.Ne 1 1 }} → false
{{ compare.Ne 1 2 }} → true

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

Comparing numbers of different types:

{{ compare.Ne 1 1.0 }} → false

Comparing other data types:

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