I don't code in that language but my bet is that allCardList.count returns an unsigned quantity and -2, in an attempt to push it below zero, will return you a very large unsigned number.
-1 > 8? comparing two integers, negativeOne and eight diff than (negativeOne + 1) and (eight + 1)
-
30-05-2022 - |
Question
Here's the code:
while((fingerYLast - fingerAt.y) > fingerMoveThresh)
{
if( (activeCard) < (allCardList.count - 2))
{
[self sayOut:@"TRUE"];
activeCard = activeCard + 1;
}
else
{
//WTF????
[self sayOut:[NSString stringWithFormat:@"FALSE %i %i",
activeCard, (allCardList.count - 2)]];
}
fingerYLast -= fingerMoveThresh;
}
I've checked the test values, and activeCard is -1, and allCardList has 10 members.
activeCard = -1;
(activeCard) < (allCardList.count - 2) //evaluates as false
(activeCard+1) < (allCardList.count - 1) //evaluates as true
Any ideas?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow