echsor
05/22/2024, 7:42 PMechsor
05/22/2024, 7:45 PMAdam S
05/22/2024, 8:49 PMfor
entry in the list. Then click on the lightbulb in the bottom rightAdam S
05/22/2024, 8:50 PMAdam S
05/22/2024, 8:51 PMKlitos Kyriacou
05/23/2024, 8:05 AMechsor
05/23/2024, 10:55 PM.forEach {}
?echsor
05/23/2024, 10:56 PMKlitos Kyriacou
05/24/2024, 8:04 AMfor (element in collection) { ... }
has different semantics than collection.forEach { ... }
. In the latter takes a function-type argument and the block is actually a lambda that introduces a new meaning for the identifier it
, the break
and continue
statements cannot be used, etc. The plain for
loop is much simpler: the code inside the block is just code inside the block, and not part of another function.Klitos Kyriacou
05/30/2024, 3:20 PMfor
loops: https://kotlinlang.org/docs/coding-conventions.html#loops