Chills
01/06/2021, 9:32 AMfor-loop
https://pastebin.com/K1uQx2mL
sophia.likedPeople.stream().forEach(x->println(x.name))
gildor
01/06/2021, 9:53 AMwhy do we have different syntax fordifferent comparing to what?for-loop
gildor
01/06/2021, 9:55 AMsophia.likedPeople.stream().forEach(x->println(x.name))This is incorrect Kotlin syntax, it’s not how lambda syntax works in Kotlin you need:
stream().forEach { x -> println(x.name) }
gildor
01/06/2021, 9:55 AMChills
01/06/2021, 10:07 AMdifferent comparing to what?Java , my bad for not pointing that out.
gildor
01/06/2021, 1:35 PMin
instead of colonChills
01/06/2021, 4:17 PMgildor
01/07/2021, 12:04 AMChills
01/07/2021, 5:42 AMChills
01/07/2021, 5:42 AMgildor
01/07/2021, 7:10 AMgildor
01/07/2021, 7:10 AMwhile
+ break
works for itFredrik Rødland
01/09/2021, 4:40 PMfor (i in 1..5) {
println(i)
}
also: https://try.kotlinlang.org/#/Examples/Basic%20syntax%20walk-through/Use%20a%20for-loop/Use%20a%20for-loop.ktChills
01/09/2021, 5:26 PMChills
01/09/2021, 5:28 PM