typeover
curriculum

Curriculum Idioms & ecosystem Defer exercise 4 · fill-word

Defer

Type the keyword that schedules a function call to run when the enclosing function returns.

TypeScript reference
Fill the blanks →

About this theme

defer fn() schedules fn to run when the surrounding function returns. The closest TS analogue is a try/finally you don't have to indent. Multiple defers run LIFO. Arguments are evaluated at the defer site, not at the call site — a common surprise. Also: defer in a loop accumulates.