I'm aware bringing yet another syntax topic will be bashed instantly. I'm sorry I can't resist.
Don't you think having a 'var' in front of every declaration introduces quite a bit of noise and is hard to read? I can obviously see a purpose for var to mark mutability of a variable, but since we also have 'let' isn't it redundant? If not what is reasoning behind it, perhaps I'm missing important point?
'let' is for immutable declaration, 'var' is for mutable declaration. Besides, who says you have to put 'var' in front of every variable declaration?
This:
var
a: string
b = 5
Is perfectly legal syntax.
And before you ask, doing without 'var' and 'let' altogether would be ill advised - such a change would cause ambiguities to arise between variable declaration and assignment.
@kuba: I don't want to sound rude, but haven't you read tutorial 1? http://nim-lang.org/tut1.html#the-var-statement
I am all for asking questions and getting answers - but I would hope beginners (like myself a few months back) at least reads the two tutorials first.
var variable = default()
...
varaible = foo() # notice the typo
...
useValue(variable)
This class of bugs is a huge problem in languages with implicit variable declarations.
You can easily get Go's := with a template if you really don't like the look of var:
template `:=`(x, y) =
var x = y
x := 10
echo x