Intermediate Go (Golang)
Q84 / 100

What is the time.Ticker vs time.Timer difference?

Correct! Well done.

Incorrect.

The correct answer is B) time.Timer fires once after a duration; time.Ticker fires repeatedly at a fixed interval until stopped

B

Correct Answer

time.Timer fires once after a duration; time.Ticker fires repeatedly at a fixed interval until stopped

Explanation

time.NewTimer(5*time.Second) fires once. time.NewTicker(1*time.Second) fires every second. Always call Stop() to release resources.

Progress
84/100