Golang variável em string
package main
import (
"fmt"
)
func main() {
hello := "hello"
helloWorld := fmt.Sprintf("%s world", hello)
fmt.Println(helloWorld)
}
Bearbite
package main
import (
"fmt"
)
func main() {
hello := "hello"
helloWorld := fmt.Sprintf("%s world", hello)
fmt.Println(helloWorld)
}
// using var
var name1 = "Go Programming"
// using shorthand notation
name2 := "Go Programming"
// Program to create a string in Golang
package main
import "fmt"
func main() {
// creating string using var
var message1 = "Hello,"
// creating string using shorthand notation
message2 := "Welcome to Programiz"
fmt.Println(message1)
fmt.Println(message2)
}
str := "Hello"