From 42488bb097fe0a9de5dd7faa2d270cff479e3ecf Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Sun, 28 Jan 2024 08:42:30 -0800 Subject: [PATCH] Add string concat example to math.Add --- content/en/functions/math/Add.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/content/en/functions/math/Add.md b/content/en/functions/math/Add.md index afa8d48aa..4e05f7170 100644 --- a/content/en/functions/math/Add.md +++ b/content/en/functions/math/Add.md @@ -22,3 +22,14 @@ If one of the numbers is a [`float`], the result is a `float`. ``` [`float`]: /getting-started/glossary/#float + +You can also use the `add` function to concatenate strings. + +```go-html-template +{{ $s := slice "h" "u" "g" "o" }} +{{ $t := "" }} +{{ range $s }} + {{ $t = add $t . }} +{{ end }} +{{ $t }} → hugo +```