Re: Which is the preferred style: call(x) or call x
> Nim standard doesn't have a preference. Go with whatever makes the most sense > to you in the context. > > For example I always drop the parens when calling echo. myfunc by itself > without the x is reference to the function. > > So you could pass myFunc to myFunc2 by calling > > myFunc2(myFunc) > > or > > myFunc2 myFunc > > or even > > myFunc.myFunc2 > > look up > [https://nim-lang.org/docs/manual.html#procedures-method-call-syntax](https://nim-lang.org/docs/manual.html#procedures-method-call-syntax) > and > [https://nim-lang.org/docs/manual.html#procedures-command-invocation-syntax](https://nim-lang.org/docs/manual.html#procedures-command-invocation-syntax) > for all the rules
Re: Which is the preferred style: call(x) or call x
It is _not_ a single argument, it can take any number of arguments, you can do `myfunc x, y, z`, you can choose what you need and want to, depends on what are you doing, and `myfunc"string argument"` is also possible, it allows you to chain functions, like `"argument".myfunc.otherfunc.anotherfunc()`.
Which is the preferred style: call(x) or call x
I've found that when I have a call with a single argument, say, myfunc(x), I can change it to myfunc x. This surprised me since coming from Python I'd have thought myfunc is a reference to the function, but clearly that's not the case with nim. (So, how do you get a function reference?) But out of the two call syntaxes, which is to be preferred?