Last active
December 26, 2023 15:47
var vs :=
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// var | |
// Valor zero | |
var x int | |
// Multiplos com mesmo tipo | |
var x, y int = 10, 20 | |
// Multiplos com tipos diferentes e com inferencia | |
var x, y = 10, "hello" | |
// Multiplos com declaration list | |
var ( | |
x int | |
y = 20 | |
z int = 30 | |
d, e = 40, "hello" | |
f, g string | |
) | |
// := | |
x := 10 | |
// Multiplos | |
x, y := 10, "hello" | |
// Sobrescrevendo uma variável que já foi inicializada | |
x := 10 | |
x, y := 30, "hello" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment