This program contains errors. Fix errors and run the program

Hi there. I’m trying to solve this easy code cause i’m a beginner but I can’t fix it, How can I do?

What have you tried so far? What is the errors you get? What would be the expected behavior?

Also, please copy code as text into triple back ticks or intend them by 4 spaces like this:

```go
package main
```

or

    package main

Will be rendered as:

package main

or

package main

Okay so, this is an exercise that I have to solve, given by my teacher. It says that “This program contains errors. Fix errores and run the program” , so I’ve write you the code that needs to solve. I think there are 2 or 3 easy errors to fix, but I don’t know how can I do… I’ll write you the code

package main
import “fmt”

func test(x int) y int, z int
{
var y int = x + 1
var z int = x + 2
return
}

func main() {
var a, b int
a, b = test(10)

fmt.Println(a, b)
}

Have you tried to build and run? What errors do you get? What did you try to fix them?

It is an exercise you received, not we…

We love to help you understanding the problems that arise, we love to guide you fixing them, but we will not do your homework for you.

1 Like

I only ask for a help because I cannot see the errors, not to do my homework cause I’ve tried already to solve it… Anyway, thank you.

Why can’t you see the errors? They should be printed once you go build or go run, if you don’t have go set up, use the playground.

1 Like