typeover
curriculum

Curriculum Concurrency Select exercise 1 · mcq

Select

select is Go's primitive for waiting on multiple channel operations at once. Pick the line that opens a select block — the shape that's distinct from switch. TypeScript: Promise.race([...]) is the closest analog but races resolved values, not channel operations.

TypeScript reference
Pick the idiomatic Go translation

About this theme

select waits on multiple channel operations and runs the case for whichever is ready first. With a default branch it becomes non-blocking. Paired with time.After(d) it becomes a timeout. This is the closest thing Go has to a "wait on a set of futures" primitive.