mIRC Home    About    Download    Register    News    Help

Print Thread
Minor Documentation Fix #147263 16/04/06 07:36 PM
Joined: Aug 2005
Posts: 128
S
stefys99 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Aug 2005
Posts: 128
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.

Re: Minor Documentation Fix #147264 16/04/06 08:17 PM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
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.

Re: Minor Documentation Fix #147265 16/04/06 08:27 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
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.

Re: Minor Documentation Fix #147266 16/04/06 08:28 PM
Joined: Feb 2005
Posts: 681
M
mIRCManiac Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
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

Last edited by mIRCManiac; 16/04/06 08:28 PM.
Re: Minor Documentation Fix #147267 16/04/06 09:34 PM
Joined: Aug 2005
Posts: 128
S
stefys99 Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Aug 2005
Posts: 128
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)

Last edited by stefys99; 16/04/06 09:36 PM.
Re: Minor Documentation Fix #147268 16/04/06 11:39 PM
Joined: Feb 2005
Posts: 681
M
mIRCManiac Offline
Fjord artisan
Offline
Fjord artisan
M
Joined: Feb 2005
Posts: 681
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

Last edited by mIRCManiac; 16/04/06 11:41 PM.