Answers for "golang create new variable"

Go
0

golang set env var

// set env var "FOO" to value "1"
    os.Setenv("FOO", "1")
    // will print "FOO: 1"
    fmt.Println("FOO:", os.Getenv("FOO"))
Posted by: Guest on October-29-2020
0

golang variable in string

package main

import (
	"fmt"
)

func main() {
	hello := "hello"
	helloWorld := fmt.Sprintf("%s world", hello)
	fmt.Println(helloWorld)
}
Posted by: Guest on July-16-2021

Browse Popular Code Answers by Language