Take for example StringReplace function. How should I know that OutputVar (first parameter) should be an expression? There is no such thing in the documentation that says: "this parameter must be an expression" or "this parameter must use legacy syntax".
Does user have to guess/deduce/try whether treat parameter as expression/legacy syntax?
How to know whether parameter expects an expression? Topic is solved
Re: How to know whether parameter expects an expression?
That command is deprecated, but an output variable is simply a variable name and nothing more or less. Fortunately, all of the commands come with examples in the documentation.
OutputVar. The name of the variable in which to store the result of the replacement process.
Last edited by mikeyww on 10 Jan 2022, 09:42, edited 2 times in total.
Re: How to know whether parameter expects an expression? Topic is solved
In short:
Outputvar parameters: never expressions (but variable names)
all other parameters: just force expression mode (% with a space following) for them, if you are unsure.
Details:
Outputvar parameters: never expressions (but variable names)
all other parameters: just force expression mode (% with a space following) for them, if you are unsure.
Details:
Spoiler
Re: How to know whether parameter expects an expression?
@gregster Thank you so much, gregster for your detailed answer. So now i can see why it was confusing to me, because i use commands with "output var name" parameters very often.
So i want to learn how to use everything, because not everyone always forces an expression, right? And i want to be able to understand the other's people code.
But now i think i understand pretty much everything about this topic, so this topic can be closed now.
So i want to learn how to use everything, because not everyone always forces an expression, right? And i want to be able to understand the other's people code.
But now i think i understand pretty much everything about this topic, so this topic can be closed now.
Re: How to know whether parameter expects an expression?
The times you see an expression in a command parameter without forcing an expression are when the documentation states that a particular parameter “can be an expression.” See the documentation for Sleep, for example. That allows for the following without a forced expression:
Code: Select all
Sleep, Minutes * 60 * 1000