slice.md (662B)
1 ---
2 title: slice
3 # linktitle: slice
4 description: Creates a slice (array) of all passed arguments.
5 date: 2017-02-01
6 publishdate: 2017-02-01
7 lastmod: 2017-02-01
8 categories: [functions]
9 menu:
10 docs:
11 parent: "functions"
12 keywords: [slice, array, interface]
13 signature: ["slice ITEM..."]
14 workson: []
15 hugoversion:
16 relatedfuncs: []
17 deprecated: false
18 draft: false
19 aliases: []
20 toc: false
21 ---
22
23 One use case is the concatenation of elements in combination with the [`delimit` function][]:
24
25 {{< code file="slice.html" >}}
26 {{ delimit (slice "foo" "bar" "buzz") ", " }}
27 <!-- returns the string "foo, bar, buzz" -->
28 {{< /code >}}
29
30
31 [`delimit` function]: /functions/delimit/