4 ms·
Having both := and = goes back a long, long, long way. Go isn't even the 100th language to differentiate them.
by adgar 15y ago
Having both := and = goes back a long, long, long way. Go isn't even the 100th language to differentiate them.
- 4ad 15y ago:= and = don't do what you probably think they do, the meaning is not the same as in Pascal. If you need to compare two variables, you use == if a == b {} = is the usual assignment, := declares and initializes a variable inferring the type. var a int a = 42 vs. a := 42 That means you'll see explicit types in variable declarations rarely.