Curriculum Idioms & ecosystem Defer exercise 2 · mcq
Defer
Multiple defer statements in the same function run in a
specific order on return. Pick the description of that
order.
TypeScript reference
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.