String Concatenation
Examples
Filter
package main
import (
"fmt"
"strings"
)
func main() {
s := "Hello"
t := s + " World"
fmt.Println(t)
// Using a builder
var b strings.Builder
b.WriteString("Good")
b.WriteString("Bye\n")
fmt.Println(b.String())
}
s := "hello"
s2 := s + " world" // + is used to concatenate strings
println(s2)
mut s3 := "hello "
s3 += "world" // += is used to append to a string
println(s3) // "hello world"
Last Run
:
hello world
hello world