typeover
curriculum

Curriculum Concurrency Select exercise 5 · fill-word

Select

Type the keyword used inside a select block to mark the non-blocking fallback case — the one that runs immediately when no channel case is ready.

TypeScript reference
Fill the blanks →

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.