the above code produces the below output, if we use "return" on the line 5 we will be getting the below output, because that will abundantly break and come out of the method. You can see the "Done" is not printed.
Hence to resolve we can try out with the label concept available in kotlin, Since our programming language says there is no explicit label needed for the inline function. we can directly use it as "return@forEach". But this will also lead to be failed, this produces the below output.
The highlighted text are unnecessary to this case. In the below code snippet run block with label is used to break the loop as soon as we get the expected result and breaks the blocks and proceeds the normal flow function flow.
And will get the expected output.
Happy Coding :-)