It is by design.
Crash&Burn wrote:
if() doesn't
'If' is not a command per se. It is used in syntax very distinct from commands; keywords are used to both delimit the arguments and determine what action/command it actually is:
Code:
If var
If var between low and high
If var in matchlist
If var contains matchlist
If var is type
If var = value
If var != value
If var > value
If var < value
etc.
From a "purely implementation" perspective, IF() is only allowed because an exception is specifically made for it when determining whether the line begins with a function call or definition:
Code:
if ( !(action_end && *action_end == '(' && action_end != aBuf
&& (action_end - aBuf != 2 || strnicmp(aBuf, "IF", 2)))
|| action_end[1] == ':' )
return false;
Supporting While() seems to be a simple matter of adding an exception for it:
Code:
if ( !(action_end && *action_end == '(' && action_end != aBuf
&& (action_end - aBuf != 2 || strnicmp(aBuf, "IF", 2))
&& (action_end - aBuf != 5 || strnicmp(aBuf, "WHILE", 5)))
|| action_end[1] == ':' )
return false;
Crash&Burn wrote:
While is part of the "flow of control", "While ()" and "if() || if ()" appear to be the only Control Commands/Statements that accept brackets.
return (%MyVar%) is one example given in the help file.
Loop (*) is a valid file loop, matching any filenames beginning with ( and ending with ).
Any argument which accepts text or an expression can legitimately begin with ( and end with ).
To clarify my point of view: it is by design, but designs can and sometimes should be changed.
Btw, none of the examples in the
help file surround a While's expression with parentheses.