Quantcast
Viewing all articles
Browse latest Browse all 5

Answer by user for Golang mixed assignment and declaration

In short: as a, b = 2, 3 means "assign both" and a, b := 2, 3 means "declare and assign both", and you need to assign one and declare and assign the other, the solution is to declare the other and assign both:

a := 1{    var b int    a, b = 2, 3}

Viewing all articles
Browse latest Browse all 5

Trending Articles