0

I'm a noob at GO, Just starting to learn the language. why is this fine:

const name, age = "Kim", 22

but this is not

const name, age := "Kim", 22

phuclv
  • 37,963
  • 15
  • 156
  • 475

1 Answers1

5

From A Tour of Go:

Constants cannot be declared using the := syntax.

:= is used to declare a variable inferring its type from the value. Though, declaring and initializing a variable is not the same as declaring a constant. See also here and here.

pzaenger
  • 11,381
  • 3
  • 45
  • 46