See more
Defer statement defers the execution of a function until the surrounding function returns. Multiple defers are pushed into stack and executes in Last In First Out (LIFO) order. Defer generally used to clean…