try / catch / finally Playground

Dina walks ambil()’s house room by room: a return hands her a parcel, a throw sends her to catch with the error’s envelope, and she always passes through…

Why it matters

finally is the place for cleanup that is guaranteed to run (closing a connection, releasing a lock, hiding a spinner), success or error. Misread its order and you get leaked resources, skipped cleanup, or errors that vanish without a trace.

The key idea

finally runs AFTER the return is ready, BEFORE the function leaves

Common mistakes

Try it in this playground