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

Goroutine for timer #126

Closed
milkaxq opened this issue Oct 13, 2023 · 1 comment
Closed

Goroutine for timer #126

milkaxq opened this issue Oct 13, 2023 · 1 comment

Comments

@milkaxq
Copy link

milkaxq commented Oct 13, 2023

Hello. I wrote code that looks like mycode. So I wanted to ask about difference between creating 2 channels (answer and time) and 1 goroutine for timer only is there any disadvantages in my code?

@joncalhoun
Copy link
Contributor

Unfortunately I don't have the capacity to do in-depth code reviews or to provide much 1-on-1 support for these exercises anymore, but glancing at your code I would say the primary difference is that in your code it would be much harder to start a second quiz immediately after the first one ends, especially if the first one ends with a timeout. If you want to see it first hand, attempt to update your code so that the user takes two different quizzes back to back before the program terminates. What happens if they timeout the first quiz and then you try to start the second quiz?

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

2 participants