VOOZH about

URL: https://www.geeksforgeeks.org/go-language/zero-value-in-golang/

⇱ Zero value in Golang - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Zero value in Golang

Last Updated : 12 Jul, 2025
In Go language, whenever we allocate memory for a variable with the help of declaration or by using new and if the variable is not initialized explicitly, then the value of such types of variables are automatically initialized with their zero value. The initialization of the zero value is done recursively. So, every element of the array of the structs has its fields zero if they are not specified with any value. Following are the zero values for different types of variables:
Type Zero Value
Integer 0
Floating point 0.0
Boolean false
String ""
Pointer nil
Interface nil
Slice nil
Map nil
Channel nil
Function nil
Example 1: Output:
Zero value for integer types: 0
Zero value for float64 types: 0
Zero value for boolean types: false
Zero value for string types: 
Zero value for slice types: []
Zero value for pointer types: <nil>
Zero value for map types: map[]
Example 2: Output:
False
True
True
True
True
True
True
Comment
Article Tags:
Article Tags:

Explore