Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Basics: Introduction to Coroutines in Kotlin Playground #42

Open
nous-krinit opened this issue Jul 30, 2024 · 0 comments
Open

Comments

@nous-krinit
Copy link

Course: Android Basics with Compose
Module: Connect to the Internet - Get Data
Section: Introduction to Coroutines in Kotlin Playground

In this section, the content briefs about Cancellation in Coroutines. There is an issue with the explanation here. Please refer to the below image

image

In this example, it is mentioned that "The weather report only consists of the weather forecast Sunny, but not the temperature because that coroutine was cancelled."
But the reason why weather report only consists of weather forecast Sunny but not temperature because we are not returning temperature back.

  1. If the temperature coroutine is cancelled and if we try to return temperature, it returns following error - DeferredCoroutine was cancelled
  2. If coroutine is not cancelled and if we don't return temperature, the code will print weather forecast Sunny without temperature anyway

So cancel and temperature not being in the weather forecast have no relation and the example given does not make sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant