Kotlin TutorialLesson 15Free preview
Kotlin Break/Continue
This lesson is part of Kotlin · All levels
Summary
This lesson reviews the break and continue controls in Kotlin. In addition to regular use, Kotlin provides a powerful feature called labeled jump (label@) that allows the developer to stop or continue the outer loop specifically from within the nested loop.
Key points
- The 'break' order to stop the enforcement of the nearest repeat
- The 'continue' command skips the rest of the current iteration instructions and moves on to the next iteration
- Label defined by name followed by the '@' sign (e.g. 'loopLuar@')
- The use of 'break@label' or 'continue@label' facilitates the control of nested loops without complicated boolean flags
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.