- What is the result of the following code?
package main
import "fmt"
func add(x, y int) {
var z int = x + y
return z
}
func main() {
fmt.Print(add(3, 2))
}
-
Fix the code above
-
Will the following code work properly? Explain
package main
import "fmt"
func add(x, y int) (z int) {
z = x + y
return
}
func main() {
fmt.Print(add(3, 2))
}
Click here to view the solution