Search code examples
functiongoargumentsnamed

Is it possible in Go to call a function with named arguments?


I want to call a function in Go, and attach to the argument values the argument names

func sum(a int, b int) int {
  return a + b
}

func main() {
  result := sum(a=4, b=5) // result == 9
}

Is it possible?


Solution

  • There is no such thing like named arguments in go