title: Return from lambda in Kotlin
body: <p>I am new the Kotlin programming and getting confused about returning something from a lambda. I think I understood the most but the following code is really creating problem to me.</p>
  <p>When it is written that <code>if(it==0) return@forEach</code> then it should mean that return out of the forEach loop. Or in other words, exit the forEach loop. But it still continues to check the remaining items in the list.</p>
  <p>Here is the code I am following</p>
  <pre><code>fun main(args: Array&lt;String&gt;) {
  
   val listOf10 = listOf(2, 4, 0, 9, 8)
  
   listOf10.forEach {
      if (it == 0) return@forEach
      println(it)
   }
  
  }
  </code></pre>
  <p>The expected output is <code>2,4</code> but it gives <code>2,4,9,8</code>.
  Can anyone here help me out with this?</p>
  <p>Thank you</p>