Default or zero value of an interface is nil. Below program demonstrates that
package main
import "fmt"
type animal interface {
breathe()
walk()
}
func main() {
var a animal
fmt.Println(a)
}
Output
nil
Default or zero value of an interface is nil. Below program demonstrates that
package main
import "fmt"
type animal interface {
breathe()
walk()
}
func main() {
var a animal
fmt.Println(a)
}
Output
nil