Standard library / reflect

reflect.Value.IsNil()

Check nil for chan, func, interface, map, pointer or slice values. Other kinds, including invalid, panic. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (v Value) IsNil() bool

Return Value

bool

Check nil for chan, func, interface, map, pointer or slice values.

Working Example

Example Snippetgo
package main
import (  "fmt"  "reflect")
func main() { fmt.Println(reflect.ValueOf((*int)(nil)).IsNil()) }
Go Reference