• Declare variadic function
  • Variadic function parameter type is .... Different from slice.
  • Action can be defered with a defer statement. Defered function will be called after function contains the defer statement has been done (after return value).
  • Any number of defer can be declared, it will be executed by reversed defer order.

  • Need extra parentheses when defer a function. Ex. defer f()()
  • A defered function can observe the function’s result.
  • A defered function can even change the result. Ex.

What to read next

Previous / Next
Previous: Go - Functions - 4 Next: Go - Functions - 6 (panic, recover, stackTrace)
More like this
Subscribe via RSS: Macro · Tech

Tags:

Updated: