Defer
Defer is used to execute a statement while exiting the current block.
When there are multiple defers in a single block, they are executed in reverse order.
Defer is useful to ensure that resources are cleaned up when they are no longer needed. Instead of needing to remember to manually free up the resource, you can add a defer statement right next to the statement that allocates the resource.