这是日志:
2016-02-05 08:17:39.037 ASAP[70510:7996026] sortTasksIntoDaySeperatedArrays | SORTED_TASKS:(
{
"TASK_DURRATION" = 1;
"TASK_NAME" = Now;
"TASK_START_TIME" = 1454678259;
},
{
"DAY_OF_WEEK" = Sunday;
"TASK_DURRATION" = 600;
"TASK_NAME" = "Sunday Breakfast 9AM";
"TASK_START_TIME" = 1454853634;
}
)
2016-02-05 08:17:39.065 ASAP[70510:7996026] DAYS_COUNT:7
2016-02-05 08:17:39.065 ASAP[70510:7996026] FINAL_END_GAME_ARRAY:(
)
功能
-(void)sortTasksIntoDaySeperatedArrays{
NSMutableArray *FinalSortedDaysArray=[[NSMutableArray alloc]init];
NSMutableArray *nextSevenDaysArray=[self nextSevenDays];
NSLog(@"NEXT_SEVEN:%@",nextSevenDaysArray);
NSMutableArray *sortedTasks=[self getAndSortAllTasks];
NSLog(@"sortTasksIntoDaySeperatedArrays | SORTED_TASKS:%@",sortedTasks);
NSLog(@"DAYS_COUNT:%lu",(unsigned long)nextSevenDaysArray.count);
int q;
for(q = 0;q ==7;q = q + 1){
NSLog(@"LOOP");
}
NSLog(@"FINAL_END_GAME_ARRAY:%@",FinalSortedDaysArray);
}
答案 0 :(得分:4)
for(q = 0;q ==7;q = q + 1)
{
// do stuff
}
当测试条件为真时,这将经历循环 - 也就是说,当q = 7时,这将永远不会发生,因为您刚刚将其设置为0
如果您想要通过直到 q = 7,就可以这样做
for(q = 0;q < 7; q++)
{
// do stuff
}