Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumGobenchmarksSingle-choice MCQ

Why is a `sink` package-level variable assigned inside this benchmark loop?

var sink int func BenchmarkFib(b *testing.B) { var r int for i := 0; i < b.N; i++ { r = fib(20) } sink = r }