You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the problem
Hello. I'm not sure if there's a problem, but I'm pretty confused.
On the last step of [6. Use the repeat() function] it's offered to move the call of the treatFunction() into the repeat() function's lambda expression:
repeat(4) {
treatFunction()
}
This will result in the following output:
5 quarters
Have a treat!
Have a treat!
Have a treat!
Have a treat!
No treats! // the result of trickFunction() call, it's not interesting right now
At the same time one call of the treatFunction() results in the next output:
5 quarters
Have a treat!
Why only "Have a treat!" is repeated? Looks like 'extraTreat' lamda expression is lost after the 1st repeat() iteration. Why so?
See error... The result is:
5 quarters
Have a treat!
Have a treat!
Have a treat!
Have a treat!
No treats!
My expectation the result is to be:
5 quarters
Have a treat!
5 quarters
Have a treat!
5 quarters
Have a treat!
5 quarters
Have a treat!
No treats!
Versions Android Studio version: API version of the emulator:
Additional information Include screenshots if they would be useful in clarifying the problem.
Please follow the link on Kotlin playground: https://pl.kotl.in/2S46SnuP3
The text was updated successfully, but these errors were encountered:
URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-function-types-and-lambda?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-2-pathway-1%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-function-types-and-lambda#5
In which task and step of the codelab can this issue be found?
6. Use the repeat() function, the last step
Describe the problem
Hello. I'm not sure if there's a problem, but I'm pretty confused.
On the last step of [6. Use the repeat() function] it's offered to move the call of the treatFunction() into the repeat() function's lambda expression:
repeat(4) {
treatFunction()
}
This will result in the following output:
5 quarters
Have a treat!
Have a treat!
Have a treat!
Have a treat!
No treats! // the result of trickFunction() call, it's not interesting right now
At the same time one call of the treatFunction() results in the next output:
5 quarters
Have a treat!
Why only "Have a treat!" is repeated? Looks like 'extraTreat' lamda expression is lost after the 1st repeat() iteration. Why so?
Steps to reproduce?
5 quarters
Have a treat!
Have a treat!
Have a treat!
Have a treat!
No treats!
My expectation the result is to be:
5 quarters
Have a treat!
5 quarters
Have a treat!
5 quarters
Have a treat!
5 quarters
Have a treat!
No treats!
Versions
Android Studio version:
API version of the emulator:
Additional information
Include screenshots if they would be useful in clarifying the problem.
Please follow the link on Kotlin playground: https://pl.kotl.in/2S46SnuP3
The text was updated successfully, but these errors were encountered: