Sunday, 23 August 2015

Basic Go: Defer

A defer statement defers the execution of a function until the surrounding function returns.

The deferred call's arguments are evaluated immediately, but the function call is not executed until the surrounding function returns.


Stacking defers

Deferred function calls are pushed onto a stack. When a function returns, its deferred calls are executed in last-in-first-out order.


Do comment, if it worked/Not worked for you.

No comments:

Post a Comment