| 1 |
--- |
| 2 |
title: compare.Ne |
| 3 |
description: Reports whether the first argument is not equal to any of the subsequent arguments. |
| 4 |
categories: [] |
| 5 |
keywords: [] |
| 6 |
params: |
| 7 |
functions_and_methods: |
| 8 |
aliases: [ne] |
| 9 |
returnType: bool |
| 10 |
signatures: ['compare.Ne ARG1 ARG2 [ARG...]'] |
| 11 |
aliases: [/functions/ne] |
| 12 |
--- |
| 13 |
|
| 14 |
## Usage |
| 15 |
|
| 16 |
The `compare.Ne` function reports whether the first argument is not equal to any of the subsequent arguments. You can also use this function to compare strings, boolean values, dates, and other comparable data types. |
| 17 |
|
| 18 |
## Examples |
| 19 |
|
| 20 |
```go-html-template |
| 21 |
{{ compare.Ne 1 1 }} → false |
| 22 |
{{ compare.Ne 1 2 }} → true |
| 23 |
|
| 24 |
{{ compare.Ne 1 1 1 }} → false |
| 25 |
{{ compare.Ne 1 1 2 }} → false |
| 26 |
{{ compare.Ne 1 2 1 }} → false |
| 27 |
{{ compare.Ne 1 2 2 }} → true |
| 28 |
``` |
| 29 |
|
| 30 |
Comparing other data types: |
| 31 |
|
| 32 |
```go-html-template |
| 33 |
{{ compare.Ne "ab" "a" }} → true |
| 34 |
{{ compare.Ne time.Now (time.AsTime "1964-12-30") }} → true |
| 35 |
{{ compare.Ne true false }} → true |
| 36 |
``` |