Hy there, i'm a newbie, sorry if my question is silly.
This code is ok:
var x, y, z = 3
let a, b, c = 4
echo(x + y + z + a + b + c)
but this is not:
var x, y, z = 3
let a, b, c = 4
echo(x + y + z + a + b +c)
missing a blank in "+c". Compiler says
- Error: attempting to call routine: 'b'
- found 'b' of kind 'let'
Why? Thx.
Interesting that
var x, y, z = 3
is allowed. Have not really guessed that a 3 vars would get initial value 3.
For your problem:
echo(x + y + z + a + b +c) is evaluated as echo(x + y + z + a + b(+c))
Because Nim can accept arguments without () as we use generally for echo.
echo(x+y+z+a+b+c)
with no spaces is ok....
It's an inconsistent spacing problem and a quirk of the command syntax.
a + b is ok. a +b is not. a +b is equivalent to a(+(b))
This is so you can do things like
echo -3
which parses as echo(-3) instead of echo - 3. Same goes for
echo [1, 2, 3]
echo @[1, 2, 3]
# parsed as
echo([1, 2, 3])
echo(@[1, 2, 3])
# iinstead of
echo[1, 2, 3]
echo @ [1, 2, 3]