mIRC Homepage
instead of:
if (($1 < $2) && ($2 > $3) && ($3 <= $4)) { whatever }
have this:
if ($1 < $2 > $3 <= $4) { whatever }

this would be legal as well:
if (($1 < $2 > $3 <= $4) || ($1 > $4)) { whatever }
the whole string could be assigned a value as well. If it's true, it would equal 1, if it was false, it would equal 0. This would allow for even more complexity.
For Example:
if (($1 < $2 > $3 <= $4) >= ($1 > $4)) { whatever }
this would run "whatever" only if the first part is true and the second is either true or false, and also when they are both false.

of course these things would only apply to numbers. The following if/then/else equation would not be valid and would cause an '/if error' if $blah returns "hello":
if (($1 < $2 > $3 <= $blah) || ($1 > $4)) { whatever }

however, the following equation would be valid:
if ((($1 < $2 > $3) && $blah) || ($1 > $4)) { whatever }
if $blah returns $null or 0, then the first part of this if/then/else equation would be false, but if it returns "hello", then it will be true as long as $1 < $2 > $3.

smile
This isn't math, there is no order of operations. You're first example would evaluate as

if ((($1 < $2) > $3) <= $4) { whatever }

What are you going to do, explicitly state that >= has more presidance over < which in turn has less presidence than != ? it's just not possible. Find me one structured language that uses this. Personally, i think its a matter of laziness, and not being able to use a couple parenthesis.
Quote:
Find me one structured language that uses this

PHP, Python, and Delphi to start with. And that's the only 3 I happened to check (and have tables at hand). The comparisons themselves don't need precedence over each other, they simply chain together to form larger comparisons or are evaluated from left to right. It would be nice if this was possible, but because mIRC is an untyped language (and an IRC client's scripting language) it doesn't have expressions to the extent that most languages do, so I won't be holding my breath for this one.
I think that considering the few times you want to tie everything together in such a manner ... usually you are not tying every $_ together at once ... that leaving things the way they are is much better. Why bother coding something like that if it's rarely needed. Perhaps you have a use for it that you are thinking of, but I see little need for it. Especially since it's not that hard to type a few extra characters.
Firstly, there is no 'then' in mIRC if/else statements.

Secondly, can you imagine how many thousands of script this would break for just a few keystrokes? Personally I think
the current method make perfect sence and shouldn't be changed.
Riamus:
It would mean less evaluation of variables and identifiers for one thing, meaning faster condition processing when the extended conditions were used instead of excess &&'ing. Personally I don't have a problem with the speed of mIRC script but there are plenty of people who would kill for any performance gain in the language. Like I said before it's not particularly important that this be added, it would just be *nice* if it was.

katsklaw:
Regardless of whether there's a physical 'then' written in the line, an if statement is commonly referred to as if..then or if/then/else or some other twist on the term.

Why would it break scripts? He's not suggesting that conditions be changed, he's suggesting an extension to the expressions that can be used as conditions.
© mIRC Discussion Forums