Re: Compiling problem
Fwiw this "quirk" was well known when we designed the syntax. For me it's a feature, either write `x + y` or `x+y`; `x +y` is ugly and inconsistent.
Re: Compiling problem
This is so you can do things like echo -3 Run 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] Run
Re: Compiling problem
Nim requires you to use consistent spacing around binary expressions. So you can do no spaces on both sides, `a+b`, one space, `a + b`, two spaces `a + b` but you can't do one space on the left and no spaces on the right, `a +b`. As people said, this is a quirk of the command syntax `someProc arg1, arg2`.
Re: Compiling problem
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))
Re: Compiling problem
Thx you. I find interesting (and maybe a bit confusing) that > echo(x+y+z+a+b+c) with no spaces is ok
Re: Compiling problem
Interesting that var x, y, z = 3 Run 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.
Compiling problem
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.
Is there a syntax sheet of the differences between python 2 and 3 to fix a compiling problem?
I'm honestly finding it hard to learn when I'm working and one piece of code works with one software but not another. Like I needed to make a coin flip histogram. Issue is that the guy who I found the code for and modified wrote it in python 2.x (I heavily modified it because while I am learning I do have HW due. I added to it to make it a histogram and fixed it a bit) I went on Visual Studio got all the libraries for it just to run the code. Issue was that VSC ran it hella slow (like were supposed to run it 30 series with each series 100times). Matlab handled that ok from what I've heard but my code just running it 1000times (not the 3000 times the HW ask for) kinda slows the computer. So I thought why not post it into another IDE but the online ones (since it's a relatively small amount of code they should be ok) don't seem to work since I keep getting syntax errors. I posted the code. Run it 1000 times.