-1
這裏存在8個差分的代碼:-1> 8?比較兩個整數,negativeOne比(negativeOne + 1)和(8 + 1)
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;
}
我檢查測試值,並activeCard是-1,allCardList有10名成員。
activeCard = -1;
(activeCard) < (allCardList.count - 2) //evaluates as false
(activeCard+1) < (allCardList.count - 1) //evaluates as true
任何想法?
'activeCard'的類型是什麼? – Femaref
對不起,activeCard是int,allCardList是一個NSMutableArray。 – redux