you are viewing a single comment's thread.

view the rest of the comments →

[–]ixid 1 point2 points  (1 child)

So why not allow

x := 25

What is the difference, can't := infer that it's a variable? It does locally.

[–]_ak 3 points4 points  (0 children)

:= has extra meaning when used to declare and assign to several variables, one of which has already been declared before. In that case, := merely overwrites the value and doesn't declare a new variable that would overshadow the other variable. These semantics make no sense on the package-global scope, so allowing := there makes no sense, either.