What is the scope of a variable declared inside a function in Go?

  • Global
  • Local to the file
  • Local to the function
  • Local to the package
The scope of a variable declared inside a function in Go is local to that function. It means the variable can only be accessed within the function where it is declared and not outside of it.
Add your answer
Loading...

Leave a comment

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