House of Fusion
Search over 2,500 ColdFusion resources here
  
Home of the ColdFusion Community

Search flex

July 04, 2009

<<   <   Today   >   >>
Su Mo Tu We Th Fr Sa
       1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31   

Home /  Groups /  Adobe Flex

Compare to null

  << Previous Post |  RSS |  Sort Oldest First |  Sort Latest First |  Subscribe to this Group Next >> 
Top  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
adrian lynch
11/18/2008 07:24 AM

Am I right in thinking that comparing a string to null will work but a number will fail? var str:String = "A lovely string"; var num:Number = 101; if (str == null) { // This'll be ok     Alert.show("I am not a string!"); } if (num == null) { // This'll coke!     Alert.show("I am not a number, I'm a free man!"); } Seems odd one will work and one won't. Is it because a null can be implicitly converted to the string "null" and a number can't? Thanks for any insight. Adrian

Top  |   Parent  |   Reply  |   Original Post  |   RSS Feed  |   Subscribe to this Group
Author:
adrian lynch
11/18/2008 07:36 AM

Read here: http://flextips.corank.com/tech/story/cannot-use-var-nnumber-null-to-test-if that I should be using isNaN() instead. Adrian > Am I right in thinking that comparing a string to null will work but a > number will fail?


<< Previous Thread Today's Threads Next Thread >>

Mailing Lists