title: How do I break out of an infinite loop in Golang
body: <p>I'm making a program in Go for guessing a random number. I'm having issues with a for loop. </p>
  
  <ol>
  <li>I can't stop the for loop from continuously iterating.</li>
  <li><p>How do i break out of the loop once a condition is satisfied.</p>
  
  <pre><code>for loop == true {
  
  //fmt.Println("read number", i, "/n")
  if i == ans {
      fmt.Println("well done")
  }
  if i != ans {
      fmt.Println("Nope")
      fmt.Scan(i)
  }
  </code></pre></li>
  </ol>