In Go, what is a closure?

  • A closure is a function value that references variables from outside its body.
  • A function that has no parameters.
  • A function that operates only on strings.
  • A function that returns an error.
A closure in Go refers to a function value that references variables from outside its body. This allows the function to access and manipulate variables defined outside its own scope, even after the enclosing function has finished executing.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *