未使用的实体问题:表达式结果未使用XCode 4

Ric*_*k P 2 xcode entity xcode4

具有以下代码并在for语句初始化中的xs处获得上述错误.是不是在Xcode 3中得到它,只是在我今天安装Xcode 4时出现了.xs是一个

int xs = 0;
for (xs; xs<3; xs++) {
        if ([colorLayoutArray objectAtIndex:xs] == [colorLayoutArray objectAtIndex:xs+1]){
            rowCorrectCount = rowCorrectCount +1;}
}
Run Code Online (Sandbox Code Playgroud)

有线索吗?

Rob*_*ier 7

你的第一个条款中的"xs" for()什么都不做.编译器抱怨你可能不是那个意思.你的意思是以下之一:

for (int xs = 0; xs<3; xs++) {
        if ([colorLayoutArray objectAtIndex:xs] == [colorLayoutArray objectAtIndex:xs+1]){
            rowCorrectCount = rowCorrectCount +1;} }
Run Code Online (Sandbox Code Playgroud)

要么

int xs = 0;
for (; xs<3; xs++) {
        if ([colorLayoutArray objectAtIndex:xs] == [colorLayoutArray objectAtIndex:xs+1]){
            rowCorrectCount = rowCorrectCount +1;} }
Run Code Online (Sandbox Code Playgroud)