I start with the Go programming language, and I try to determine the parameter types of the Go function called addStuff , which simply adds two integers and returns their sum, but I see the following error when I try to compile the function:
prog.go:6: undefined: a prog.go:6: undefined: b prog.go:7: undefined: a prog.go:7: undefined: b prog.go:7: too many arguments to return prog.go:11: addStuff(4, 5) used as value
Here is the code that caused this compiler error:
package main import "fmt" import "strconv" func addStuff(a, b){ return a+b } func main() { fmt.Println("Hello," + strconv.Itoa(addStuff(4,5))) }
What am I doing wrong here, and what is the correct way to set parameter types in Go?
Anderson green
source share