mIRC Homepage

Minor Documentation Fix

Posted By: stefys99

Minor Documentation Fix - 16/04/06 07:36 PM

In the page "if then else" on mirc's helpfile it says:
Code:
The ! not prefix
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.

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

if (!%x) echo x has no value

which is wrong, this is not a major problem, but should be fixed in next version, since it might get some people confused.
Posted By: RusselB

Re: Minor Documentation Fix - 16/04/06 08:17 PM

How are you determining that those two lines are not the same? I've used this option (ie: using !%var rather than %var == $null) many times, and I have yet to see it fail.
Posted By: hixxy

Re: Minor Documentation Fix - 16/04/06 08:27 PM

if (%x == $null) will only be $true when %x is $null.
if (!%x) will be $true if %x is 0, $false or $null

Fairly big difference.
Posted By: mIRCManiac

Re: Minor Documentation Fix - 16/04/06 08:28 PM

if (!%x) would be true if %x were $false or $null or 0 or 0000000 ... any negative value or no value at all.

if (%x == $null) would only be true if %x has no value at all.

~ Edit ~

hixxy beat me to it smile
Posted By: stefys99

Re: Minor Documentation Fix - 16/04/06 09:34 PM

Quote:
if (!%x) would be true if %x were $false or $null or 0 or 0000000 ... any negative value or no value at all.

if (%x == $null) would only be true if %x has no value at all.

~ Edit ~

hixxy beat me to it smile

not true for negative values (only $false, 000...000, $null)
Posted By: mIRCManiac

Re: Minor Documentation Fix - 16/04/06 11:39 PM

Your examples are the same negative values I (and hixxy) gave.
And I did mean negative value for %x not negative number.
-1 is a negative number but would not be a negative value for %x
© 2019 mIRC Discussion Forums