I'm very new to programming, and I'm working my way through an Objective-C tutorial. I'm trying to get the hang of for
loops. What I'm doing is setting up a mutable array, then setting up a for
loop to get the value in every 6th index of the array. (Like the value at index 6, then 12, then 18, etc). I initialized the array, and added in A - Z into it as a tester. So, A lives at index 0, Z lives at index 25. This is the for loop I wrote:
int j;
for (j = 0; j < [myArray count]; j + 6) {
NSString *test = [myArray objectAtIndex:j];
NSLog(@"%@", test);
}
The output in the log is an endless flow of A's. I'm getting a warning on the j + 6
expression, stating "Expression result unused". Does anyone know why the above code is not working? From what I can understand (please bear with me, very new to programming) this would appear to be a valid expression for the loop. I'm failing to understand why it is not. I've browsed through all the keyword questions on here, and couldn't find any similar situations. Because of that, I'm assuming that there is probably something obvious I'm doing wrong. Any insight is much appreciated.