Introduction to External Iteration with Argument Matching
Explore how Kotlin simplifies external iteration and argument matching to make looping over ranges and collections fluent and easy. Learn to write concise, readable code with Kotlin's enhanced for loops and the powerful when expression for clearer decision logic.
We'll cover the following...
We'll cover the following...
Count the number of times you’ve used for loops in your code. Shocking. Something that’s so widely used and fundamental as iterating should be fluent, concise, easy to write, and effortless to understand. Yet, in C-like languages, for loops have rather been primitive and verbose. Not so in Kotlin.
Kotlin provides both external iterators, used in the imperative style of programming, and internal iterators, used in the functional style. With external iteration, you, as the ...