reflect.IsZero() Function in Golang with Examples Last Updated : 03 May, 2020 Comments Improve Suggest changes Like Article Like Report Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.IsZero() Function in Golang is used to check whether v is the zero value for its type. To access this function, one needs to imports the reflect package in the program. Syntax: func (v Value) IsZero() bool Parameters: This function does not accept any parameter. Return Value: This function returns whether v is the zero value for its type or not. Below examples illustrate the use of the above method in Golang: Example 1: C // Golang program to illustrate // reflect.IsZero() Function package main import ( "fmt" "reflect" ) // Main function func main() { s := struct{ A int }{0} field := reflect.ValueOf(s).Field(0) // Use of IsZero() method fmt.Println(field.IsZero()) } Output: true Example 2: C // Golang program to illustrate // reflect.IsZero() Function package main import ( "fmt" "reflect" ) // Main function func main() { s := struct{ A int }{1} field := reflect.ValueOf(s).Field(0) // Use of IsZero() method fmt.Println(field.IsZero()) } Output: false Comment More infoAdvertise with us Next Article reflect.IsZero() Function in Golang with Examples S SHUBHAMSINGH10 Follow Improve Article Tags : Go Language Golang-reflect Similar Reads reflect.Pointer() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.Pointer() Function in Golang is used to get the v's value as a uintptr. To access this function, one needs to imp 2 min read reflect.IsNil() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.IsNil() Function in Golang is used to check whether its argument v is nil. The argument must be a chan, func, int 2 min read reflect.Index() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.Index() Function in Golang is used to get the v's i'th element. To access this function, one needs to imports the 2 min read reflect.Int() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package. The reflect.Int() Function in Golang is used to get the v's underlying value, as an int64. To access this function, one needs 1 min read reflect.New() Function in Golang with Examples Go language provides inbuilt support implementation of run-time reflection and allowing a program to manipulate objects with arbitrary types with the help of reflect package.The reflect.New() Function in Golang is used to get the Value representing a pointer to a new zero value for the specified typ 2 min read Like