Yes, Nate, I had the same question.  Certainly there is a loss in
readability with the more terse syntax, since that syntax will also work
for null references.

 

"bad practice" is such a general characterization that it can and should
be challenged regularly.

 

Tracy Spratt 
Lariat Services 

Flex development bandwidth available 

________________________________

From: [email protected] [mailto:[email protected]] On
Behalf Of Sam Lai
Sent: Saturday, February 07, 2009 9:21 PM
To: [email protected]
Subject: Re: [flexcoders] Making the impossible possible, something odd
is happening

 

Curious question - why? Is there a technical reason for this, or just
a coding standard?

2009/2/8 Nate Beck <[email protected] <mailto:nate%40tldstudio.com> >:
> I haven't had a change to play with your code... but just in
general... It's
> bad practice to compare a Boolean value to True or False.
> You should simply be doing:
> if( x && y)
> instead of
> if (x == true && y == true)
> Cheers,
> Nate
>
> On Sat, Feb 7, 2009 at 5:04 PM, Cordova Aaron <[email protected]
<mailto:basicasm%40yahoo.com> > wrote:
>>
>> I have an if else block that is matching every combination, all at
once.
>>
>> To verify what I was suspecting I hard coded values to make portions
of
>> the block impossible but they are still occuring, I'm assuming that
the
>> project is not being rebuilt but when I comment lines, the code is no
longer
>> executed, but the block is still executed.
>>
>> example
>>
>> x = true;
>> y = false;
>>
>> if(x == true && y == false)
>> {
>> doSomething();
>> }
>> else if(x== false && y == false)
>> {
>> if( x == true)
>> {
>> Alert.show("Should never happen.");
>> }
>> doSomethingElse();
>> }
>> else
>> {
>> //do nothing
>> }
>>
>> In my example I'm sure that I should never see the alert message, but
I
>> get it the message every time the code is executed. I ran the 'Clean'
option
>> in under the Build menu and the source recompiled, the problem
remains.
>>
>
>
>
> --
>
> Cheers,
> Nate
> ----------------------------------------
> http://blog.natebeck.net <http://blog.natebeck.net> 
>
>
>
>
> 



Reply via email to