Skip to content

Commit

Permalink
Add examples to comparison operators
Browse files Browse the repository at this point in the history
  • Loading branch information
jmooring authored Jun 10, 2024
1 parent c5c6aa7 commit f0e95c8
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions content/en/functions/compare/Eq.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ aliases: [/functions/eq]
{{ eq 1 2 1 }} → true
{{ eq 1 2 2 }} → false
```

You can also use the `compare.Eq` function to compare strings, boolean values, dates, slices, maps, and pages.
8 changes: 8 additions & 0 deletions content/en/functions/compare/Ge.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,11 @@ aliases: [/functions/ge]
{{ ge 2 1 2 }} → true
{{ ge 2 2 1 }} → true
```

Use the `compare.Ge` function to compare other data types as well:

```go-html-template
{{ ge "ab" "a" }} → true
{{ ge time.Now (time.AsTime "1964-12-30") }} → true
{{ ge true false }} → true
```
8 changes: 8 additions & 0 deletions content/en/functions/compare/Gt.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,11 @@ aliases: [/functions/gt]
{{ gt 2 1 2 }} → false
{{ gt 2 2 1 }} → false
```

Use the `compare.Gt` function to compare other data types as well:

```go-html-template
{{ gt "ab" "a" }} → true
{{ gt time.Now (time.AsTime "1964-12-30") }} → true
{{ gt true false }} → true
```
8 changes: 8 additions & 0 deletions content/en/functions/compare/Le.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,11 @@ aliases: [/functions/le]
{{ le 2 1 2 }} → false
{{ le 2 2 1 }} → false
```

Use the `compare.Le` function to compare other data types as well:

```go-html-template
{{ le "ab" "a" }} → false
{{ le time.Now (time.AsTime "1964-12-30") }} → false
{{ le true false }} → false
```
8 changes: 8 additions & 0 deletions content/en/functions/compare/Lt.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,11 @@ aliases: [/functions/lt]
{{ lt 2 1 2 }} → false
{{ lt 2 2 1 }} → false
```

Use the `compare.Lt` function to compare other data types as well:

```go-html-template
{{ lt "ab" "a" }} → false
{{ lt time.Now (time.AsTime "1964-12-30") }} → false
{{ lt true false }} → false
```
2 changes: 2 additions & 0 deletions content/en/functions/compare/Ne.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ aliases: [/functions/ne]
{{ ne 1 2 1 }} → false
{{ ne 1 2 2 }} → true
```

You can also use the `compare.Ne` function to compare strings, boolean values, dates, slices, maps, and pages.

0 comments on commit f0e95c8

Please sign in to comment.