title: Non-blocking channel in go
body: <p>I have some code like this:</p>
  
  <pre><code>go func(ch chan bool) chan bool {
  
      // some processing
      ch &lt;- true
      return ch
  }(ch)
  
  for i := 0; i &lt; TotalQuestions; i++ {
      // check if channel ch has some value
      // If it has then execute below statements, else break out of the loop
  
  
      fmt.Println(questions[i])
      answer, _ := InputReader.ReadString('\n')
  
      // some processing
  
  }
  fmt.Println("Your Total score is " + strconv.Itoa(TotalScore) + " out of " + strconv.Itoa(TotalQuestions))
  </code></pre>
  
  <p>Now what I want to do is to check if channel ch has a value (in for loop). If it has a value then I want to break out of the for loop to print the last statement. otherwise, I want to continue my loop. I tried to insert select block but that didn't work (The channel got blocked and code didn't print questions). How to do that?</p>