Which of the following is not a valid way to call a function in Go?

  • .functionName(arguments)
  • functionName(arguments)
  • functionName(arguments)
  • package.functionName(arguments)
In Go, the package name is not required when calling a function defined within the same package. Therefore, functionName(arguments) and not package.functionName(arguments) is the correct way to call a function defined within the same package. The period (.) before the function name is also not a valid syntax in Go for calling functions.
Add your answer
Loading...

Leave a comment

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