google-developer-training / kotlin-bootcamp

Report issues with the Kotlin Bootcamp for Programmers codelab
7 stars 2 forks source link

Kotlin Bootcamp issue: #65

Closed petemit closed 4 years ago

petemit commented 4 years ago

Describe the problem

The let() function is similar to apply(), but it returns a copy of the object with the changes. This can be useful for chaining manipulations together.

This is misleading as it makes it seem that let is returning an actual copy of the object, when it is only returning the result of the transform, which could be the original object or whatever you end up returning. In which step of the codelab can this issue be found? 5

Steps to reproduce? n/a

Versions n/a

Additional information The actual signature of let is: public inline fun <T, R> T.let(block: (T) -> R): R If given an object of Type T, it will return an object of another or the same type based on the block given.

codelab: kotlin-bootcamp