String Concatenation in Go

Posted by yhuang
Public (Editable by Users)
Go
Edit
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())
}