Go

What is the difference between var x int = 2 and x := 2?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

The result is the same, a variable with the value 2.

With var x int = 2 we are setting the variable type to integer while with x := 2 we are letting Go figure out by itself the type.