Conclusion
In this lesson, you looked at the control flow constructs offered by Kotlin. You’ve learned:
- How to use if else conditions to structure code into branches.
- About the when clause that can be used as a replacement for if-else to improve readability.
- How to use evaluated expression syntax to assign the result of an if-else, and when expression to a variable.
- About the different looping constructs offered by Kotlin.
- How to iterate on a range, collection, and array using a for loop.
- How to repeat an instruction based on a condition using while and do-while loops.
- About the key difference between a while and do-while loop.