Skip to content

Instantly share code, notes, and snippets.

@magdamiu
Created December 12, 2021 20:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magdamiu/0a318b1b20b5e00430bcf65cd019e874 to your computer and use it in GitHub Desktop.
Save magdamiu/0a318b1b20b5e00430bcf65cd019e874 to your computer and use it in GitHub Desktop.
Lambdas expressions & Closure (capturing lambda) | High performance with idiomatic Kotlin
var priceBooks = 0.0
val prefixPriceDetails = "The current sum is "
books.forEach {
priceBooks += it.price
println("$prefixPriceDetails $priceBooks")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment