To concatenate two strings in Go, you can use the `+` operator or the `fmt.Sprintf()` function.
In this example,
str1
and str2
with values "Hello"
and "World"
respectively.str1
and str2
using the `+` operator and store the result in a variable named result
.result
to the console.package main
import "fmt"
func main() {
str1 := "Hello"
str2 := "World"
result := str1 + str2
fmt.Println(result)
}
HelloWorld
In this tutorial, we learned How to Concatenate Two Strings in Go language with well detailed examples.