Debian Codegraph @

docs/content/en/functions/compare/Eq.md

raw
1 ---
2 title: compare.Eq
3 description: Reports whether the first argument is equal to any of the subsequent arguments.
4 categories: []
5 keywords: []
6 params:
7 functions_and_methods:
8 aliases: [eq]
9 returnType: bool
10 signatures: ['compare.Eq ARG1 ARG2 [ARG...]']
11 aliases: [/functions/eq]
12 ---
13
14 ## Usage
15
16 The `compare.Eq` function reports whether the first argument is 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.Eq 1 1 }} → true
22 {{ compare.Eq 1 2 }} → false
23
24 {{ compare.Eq 1 1 1 }} → true
25 {{ compare.Eq 1 1 2 }} → true
26 {{ compare.Eq 1 2 1 }} → true
27 {{ compare.Eq 1 2 2 }} → false
28 ```
29
30 Comparing other data types:
31
32 ```go-html-template
33 {{ compare.Eq "ab" "a" }} → false
34 {{ compare.Eq time.Now (time.AsTime "1964-12-30") }} → false
35 {{ compare.Eq true false }} → false
36 ```