3 ms·
I believe they are referring to the lambda syntax: https://kotlinlang.org/docs/reference/lambdas.html https://kotlinlang.org/docs/reference/lambdas.html // L
by kllrnohj 8y ago
I believe they are referring to the lambda syntax: https://kotlinlang.org/docs/reference/lambdas.html https://kotlinlang.org/docs/reference/lambdas.html
// Lambdas are code blocks enclosed in curly braces.
items.fold(0, {
// When a lambda has parameters, they go first, followed by '->'
acc: Int, i: Int ->
print("acc = $acc, i = $i, ")
val result = acc + i
println("result = $result")
// The last expression in a lambda is considered the return value:
result
})
- eropple 8y agoCorrect. It looks bizarre. Ruby at least sets off the arguments with pipes.