Skip to content

Instantly share code, notes, and snippets.

@sajjadyousefnia
Created June 4, 2018 08:51
Show Gist options
  • Save sajjadyousefnia/e1f53d12c060b5700b70234aae864bf7 to your computer and use it in GitHub Desktop.
Save sajjadyousefnia/e1f53d12c060b5700b70234aae864bf7 to your computer and use it in GitHub Desktop.
fun surroundingFunction() {
val intList = listOf(1, 2, 3, 4, 5)
intList.forEach {
if (it % 2 == 0) {
return@forEach
}
}
println("End of surroundingFunction()") // Now, it will execute
}
surroundingFunction() // print "End of surroundingFunction()"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment