▲ | fatih-erikli-cg 7 months ago | |||||||||||||||||||||||||||||||
:= for assinging a variable sounds and looks weird to me | ||||||||||||||||||||||||||||||||
▲ | steve_adams_86 7 months ago | parent | next [-] | |||||||||||||||||||||||||||||||
It's the walrus operator. Pascal and Python use it as well. You get used to it pretty quickly. Pascal: https://www.freepascal.org/docs-html/ref/refse104.html#x224-... Python: https://docs.python.org/3/whatsnew/3.8.html#assignment-expre... | ||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||
▲ | linhns 7 months ago | parent | prev | next [-] | |||||||||||||||||||||||||||||||
I think it's good. 2 characters for declaration + assign. | ||||||||||||||||||||||||||||||||
▲ | indulona 7 months ago | parent | prev [-] | |||||||||||||||||||||||||||||||
it's just a shorthand for var foo int = 5 vs foo := 5 where the type is derived from the assigned value. | ||||||||||||||||||||||||||||||||
|