This content has been marked as final. Show 3 replies
do you happen to come from a PHP world???
If so, then if (!var) is possible in PHP, but not in ActionScript.
ActionScript is strong(er) typed then PHP so you have to compare a variable against something. In PHP variable can change type.. in ActionScript not.
So if (!variable) means nothing in Actionscript.
For example if var==null, what is !var ??
I dont agree,
in AS if (!var) means same as if (var==null) , remember AS is based on EcmaScript and last I checked EcmaScript still allows this kind of notation.
its actualy very easy to test :
var test:Object = null;
Alert.show(!test+""); // output true
Alert.show((test==null)+"");// output true
test = new Object();
Alert.show(!test+""); // output false
Alert.show((test==null)+""); // output false
P.S I come from java :) world .
properly you are right. I have had the same, but now trying I couldn't duplicate it.
Me coming and doing a lot with database I find the while if (!Object) very strange where a object can be null.
SELECT NULL; -- results in NULL
SELECT NOT NULL; -- result in null
Both of the below statements return true :)
select NULL IS NULL;
select (NOT NULL) IS NULL;
Anyways, I started to get used to specifying what I really mean eg:
I am nowdays using if (object == null)
I think in the above message that AS might get confused because it finds a function with the same name, might be a bug indeed....