Non-empty strings in boolean context - Flash7 2004-03-20 - By Morten Barklund
Back Hi,
When researching, I've read that in Flash MX 2004, strings converted to booleans are true, when non-empty whereas they in Flash MX were true, only when Number(string) where non-nil and non NaN.
That is:
trace("hi" ? true : false);
Traced false in Flash MX but true in Flash MX 2004.
I understand that.
But then I assumed, that this would be the case in any boolean context, where I'd assume, that the flash interpreter uses boolean conversion.
For instance, in Flash MX:
trace("hi" || "goodbye");
Traced "goodbye", as Boolean("hi") resolves to false. That is directly after the book.
Can someone please tell me, why Flash MX 2004 trace "goodbye" as well - and not "hi", which I'd assume would resolve to true?
I'm pretty lost here - please tell me that I and not Macromedia made a mistake on this one.
// Morten Barklund
=-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- Supported by Fig Leaf Software =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- Be sure to check the archives and the wiki: http://chattyfig.figleaf.com/ =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- http://chattyfig.figleaf.com/cgi-bin/ezmlm-cgi?1:mss:107541 =-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- -- To unsubscribe send a blank e-mail to: Normal Mode: flashcoders-unsubscribe@(protected) Digest Mode: flashcoders-digest-unsubscrive@(protected)
|
|