title: Is it required to assign default value to variable?
body: <p>In Go, when a variable is declared it is initialized with zero value as described in the specification.</p>
  
  <p><a href="http://golang.org/ref/spec#The_zero_value" rel="nofollow noreferrer">http://golang.org/ref/spec#The_zero_value</a></p>
  
  <p>But is it good coding practice to make use of this property and do not explicitly initialize your variable if it needs to initialized with the default value.</p>
  
  <p>for example in the following example</p>
  
  <p><a href="http://play.golang.org/p/Mvh_zwFkOu" rel="nofollow noreferrer">http://play.golang.org/p/Mvh_zwFkOu</a></p>
  
  <pre><code>package main
  
  import "fmt"
  
  type B struct {
      isInit bool
      Greeting string
  }
  
  func (b *B) Init() {
      b.isInit = true
      b.Greeting = "Thak you for your time"
  }
  
  func (b *B) IsInitialized() bool {
      return b.isInit
  }
  
  func main() {
      var b B
      if !b.IsInitialized(){
          b.Init()
      }
      fmt.Println(b.Greeting)
  }
  </code></pre>
  
  <p>The program relies on the default value of boolean to be false.</p>