Welcome To Golang By Example

Menu
  • Home
  • Blog
Menu

Zero Value of Interface in Go (Golang)

Posted on July 18, 2023July 18, 2023 by admin

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
  • go
  • golang
  • Popular Articles

    Golang Comprehensive Tutorial Series

    All Design Patterns in Go (Golang)

    Slice in golang

    Variables in Go (Golang) – Complete Guide

    OOP: Inheritance in GOLANG complete guide

    Using Context Package in GO (Golang) – Complete Guide

    All data types in Golang with examples

    Understanding time and date in Go (Golang) – Complete Guide

    ©2023 Welcome To Golang By Example | Design: Web XP