title: How do I use fmt.Scanf in Go
body: <p>I seem to be having a queer problem while getting user input within a for loop in go. 
  Here is my <a href="http://play.golang.org/p/r2ViReKCrl" rel="nofollow">code</a></p>
  
  <pre><code>package main
  
  import "fmt"
  
  func main() {
      var num int
      for i := 0; i &lt; 10; i++ {
          fmt.Printf("Debug: i : %d ", i)
          fmt.Scanf("%d", &amp;num)
          fmt.Println(num)
      }
  }
  </code></pre>
  
  <p>What happens when I run this code is this : </p>
  
  <pre><code>Debug: i : 0
  Enter next number
  1
  1
  Debug: i : 1
  Enter next number
  1
  Debug: i : 2
  Enter next number
  2
  2
  Debug: i : 3
  Enter next number
  2
  Debug: i : 4
  Enter next number
  3
  3
  Debug: i : 5
  Enter next number
  3
  Debug: i : 6
  Enter next number
  4
  4
  Debug: i : 7
  Enter next number
  4
  Debug: i : 8
  Enter next number
  5
  5
  Debug: i : 9
  Enter next number
  5
  </code></pre>
  
  <p>What I notice is that each iteration of the loop happens twice, Could this be because Go is using parallelism by default and causing both processors to run the code within a for loop?  </p>