mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-14 12:16:55 +00:00
collections.Seq: Specify max slice size
This commit is contained in:
1 parent
e24d81a4b7
commit
5058bc5201
1 file changed
+4
-8
@@ -21,7 +21,7 @@ aliases: [/functions/seq]
|
|||||||
{{ seq -2 2 2 }} → [-2 0 2]
|
{{ 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
|
```go-html-template
|
||||||
{{ $product := 1 }}
|
{{ $product := 1 }}
|
||||||
@@ -31,10 +31,6 @@ Iterate over a sequence of integers:
|
|||||||
{{ $product }} → 24
|
{{ $product }} → 24
|
||||||
```
|
```
|
||||||
|
|
||||||
The example above is contrived. To calculate the product of 2 or more numbers, use the [`math.Product`] function:
|
{{% note %}}
|
||||||
|
The slice created by the `seq` function is limited to 2000 elements.
|
||||||
```go-html-template
|
{{% /note %}}
|
||||||
{{ math.Product (seq 4) }} → 24
|
|
||||||
```
|
|
||||||
|
|
||||||
[`math.Product`]: /functions/math/product
|
|
||||||
Reference in new issue
Block a user