Concatenation means joining strings together.
In Go, use the + operator to create a new string:
message := "Hello, " + "Andy"
fmt.Println(message) // Output: Hello, Andy
You can also use += to append more text to an existing string variable:
message := "Coding is "
adjective := "worthwhile"
message += adjective
message += ", isn't it?"
fmt.Println(message) // Output: Coding is worthwhile, isn't it?
Assignment
Follow the Coding Tutorial and build the final message using +=.
Free plan: 30 tutor messages. PRO is unlimited.
Saved
Ctrl + Enter to check
