title: variable declared and not used
body: <p>I am trying to learn Go, but when trying out a simple for loop, I found it difficult to get it working. This code does not compile if I define the variable a in the main function, it gives an error 'a declared but not used'. I don't understand when a variable must be declared and when it must not be. Thanks.</p>
  
  <pre><code>package main
  
  import "fmt"
  
  func main() {   
  
  
      for a:=0;a&lt;4;a++ {      
          fmt.Printf("value of a is %d\n",a)
  }
  </code></pre>