Page 1 of 1
Functions without parenthesis
Posted: 24 Sep 2018, 19:27
by Gabby
Is it possible to have a function (actually a procedure, because the return value is discarded), called without the parentheses, like an inbuilt command or a sub in VBA?
So if we have a function Do_things(X, Y) is it possible to call it with "Do_things X, Y".
The reason I ask this is that functions are very useful to encapsulate the code (with local variables), unlike subs.
Andrew
Re: Functions without parenthesis Topic is solved
Posted: 24 Sep 2018, 20:23
by iseahound
Hey this feature is available in our
v2! (alpha)
Code: Select all
Add(2, 3)
Add 2, 3 ; Parentheses can be omitted if used at the start of a line.
https://lexikos.github.io/v2/docs/Functions.htm#intro
Re: Functions without parenthesis
Posted: 24 Sep 2018, 20:26
by Gabby
Ahh, I wait with bated breath ...
Re: Functions without parenthesis
Posted: 25 Sep 2018, 05:08
by Scr1pter
What's the difference instead of calling it by
Do_things(X, Y)
?
Regards
Re: Functions without parenthesis
Posted: 25 Sep 2018, 05:24
by Gabby
Well, for a start you don't need to remember that the ( can't be preceded by a space.
Seriously though, a few times I've need to replace 'commands' with my own functions (which *use* the command), and found this quite tedious.
Re: Functions without parenthesis
Posted: 25 Sep 2018, 05:56
by Scr1pter
Do you have a concrete example?
Regards
Re: Functions without parenthesis
Posted: 25 Sep 2018, 18:35
by Gabby
OK. Consider a block including several Send statements, which we decide to change to a call to a function Fsend to send in a different way, or with delays.
So 'send {F3}' needs to be changed to 'Fsend("{F3}")'. Takes some time to change them, and doesn't read anywhere else as well.