1 Reply Latest reply on Dec 5, 2008 12:59 AM by rshaedyn

    weird if statement behaviour

    rshaedyn
      I am building a simple memory game - you know those card flip things. I am testing if the value assigned to pic1 and pic2 are the same and using trace statements to verify that they are the same but still getting a false answer to the if statement. Pulling my hair out!!

      Any suggestions would be greatfully recieved
      Thanks,

      Leslie
        • 1. Re: weird if statement behaviour
          rshaedyn Level 1
          I've done a bit more work and it seems to have something to do with the process by which I am randomizing the numbers in the array. If I work with a plane non randomized array the if statement works and can figure out the difference between pairs that match and pairs that don't but... once I randomize the numbers by basically taking the value at a random index and putting it into a new array - the if statement equality check no longer works.

          It is almost like the number is not really an integer even though I have tried forcing it with the int() statement.
          Thoughts anyone?

          Thanks,

          Leslie