mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Sep 2015
Posts: 101
klez Offline OP
Vogon poet
OP Offline
Vogon poet
Joined: Sep 2015
Posts: 101
In the following context taken from the mIRC help file:

Quote:

You can use the ! prefix in front of variables and identifiers in an if-then-else statement to negate a value. The following statements are equivalent.

a) if (%x == $null) echo x has no value
b) if (!%x) echo x has no value


i can say it's false and let me explain why!

1. If %x doesn't exist, than the both points are true!
2. if you set %x to 0 than both a) and b) will not be equivalent, because %x is not null and ! negate the %x. The same if we set %x to $false.

Anyway, a) is different from b) smile

So, mIRC help file must be corrected smile

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
It's not false. If %X is +4, it's referring to the value of (statement) being $true or $false, not multiplying the $true value of +4 by negative 1 and making it be -4, which is also a $true value. The ! is negating whether the "then" or "else" condition applies.

(statement) is $true, even if it's a negative number, unless it returns a value that's either $null or $false or something that evaluates to zero, including strings like +0 -0 or 0.00000. There's also a pair of doublequotes with nothing inside them that is also $false, but you can't put them into a %variable.

Quote:
//var %x 0.00 | if (!%x) echo 4 if: v1 is $v1 and x is "not true": %x | else echo 2 else: v1 is $v1 and x is "true": %x


Link Copied to Clipboard