mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-27 22:09:53 +02:00
Merge commit '7125ad401ad043e46262afc7eca8dceb6d54bb9e'
This commit is contained in:
@@ -5,18 +5,12 @@ categories: []
|
||||
keywords: []
|
||||
action:
|
||||
aliases: [seq]
|
||||
related: []
|
||||
returnType: '[]int'
|
||||
signatures:
|
||||
- collections.Seq LAST
|
||||
- collections.Seq FIRST LAST
|
||||
- collections.Seq FIRST INCREMENT LAST
|
||||
related:
|
||||
- collections.Apply
|
||||
- collections.Delimit
|
||||
- collections.In
|
||||
- collections.Reverse
|
||||
- collections.Seq
|
||||
- collections.Slice
|
||||
aliases: [/functions/seq]
|
||||
---
|
||||
|
||||
@@ -27,7 +21,7 @@ aliases: [/functions/seq]
|
||||
{{ seq -2 2 2 }} → [-2 0 2]
|
||||
```
|
||||
|
||||
Iterate over a sequence of integers:
|
||||
A contrived example of iterating over a sequence of integers:
|
||||
|
||||
```go-html-template
|
||||
{{ $product := 1 }}
|
||||
@@ -37,10 +31,6 @@ Iterate over a sequence of integers:
|
||||
{{ $product }} → 24
|
||||
```
|
||||
|
||||
The example above is contrived. To calculate the product of 2 or more numbers, use the [`math.Product`] function:
|
||||
|
||||
```go-html-template
|
||||
{{ math.Product (seq 4) }} → 24
|
||||
```
|
||||
|
||||
[`math.Product`]: /functions/math/product
|
||||
{{% note %}}
|
||||
The slice created by the `seq` function is limited to 2000 elements.
|
||||
{{% /note %}}
|
||||
|
Reference in New Issue
Block a user