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]> 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

Reply via email to