Answers for "how to get the value of a type golang"

Go
2

golang get type of variable

1. reflect.TypeOf(varName)
2. fmt.Printf("%T\n", varName)
Posted by: Guest on September-08-2021
1

prints the type of a value in golang

// printType method prints the type of a value in golang
func printType() {
	x := 12
	fmt.Printf("%T", x)	// output: int
}
Posted by: Guest on July-03-2021

Code answers related to "how to get the value of a type golang"

Browse Popular Code Answers by Language