Exception Handling

finally

English

Overview

A block of code that always runs regardless of whether an exception occurred.

Details

A block that always executes after try-catch, used for tasks like releasing resources. It's easy to overlook that finally still runs even if try or catch already executed a return, and a trap exists where a return written inside finally silently overwrites the original return value.

More Programming terms