blob: d2ef62861930419c0ccd828660d0228f77754de5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
---
title: slice
description: Creates a slice (array) of all passed arguments.
categories: [functions]
menu:
docs:
parent: functions
keywords: [slice, array, interface]
signature: ["slice ITEM..."]
relatedfuncs: []
---
One use case is the concatenation of elements in combination with the [`delimit` function]:
{{< code file="slice.html" >}}
{{ $sliceOfStrings := slice "foo" "bar" "buzz" }}
<!-- returns the slice [ "foo", "bar", "buzz"] -->
{{ delimit ($sliceOfStrings) ", " }}
<!-- returns the string "foo, bar, buzz" -->
{{< /code >}}
[`delimit` function]: /functions/delimit/
|