title: How to implement this kotlin ReceiveChannel code properly
body: <p>I am following a tutorial where the teacher uses the <code>ProducerJob</code> method to demonstrate kotlin coroutine but my IDE says that method is deprecated and I should use <code>ReceiveChannel</code> instead but that also says I should use a <strong>extensions on the coroutinescope instead</strong> but I can seem to be unable to implement that correctly.</p>
  
  <p>Here the instructor's code:</p>
  
  <pre><code>fun produceNumbers() : ProducerJob&lt;Int&gt; = produce {
  
      for (x in 1..5) {
          println("send $x")
          send(x)
      }
      println("Done")
  
  } 
  
  fun main() = runBlocking{
      val channel = produceNumbers()
      channel.consumeEach {
          println(it)
      }
      println("Main done")
  
  }
  </code></pre>
  
  <p>And here is my code:</p>
  
  <pre><code>fun produceNumbers() : ReceiveChannel&lt;Int&gt; = produce {
  
          for (x in 1..5) {
              println("send $x")
              send(x)
          }
      println("Done")
  
  }
  
  fun main() = runBlocking{
      val channel = produceNumbers()
      channel.consumeEach {
          println(it)
      }
      println("Main done")
  
  }
  </code></pre>
  
  <p>Does your code compile: Yes
  Version: kotlinx-coroutines-core-0.27.0.eap13</p>