In my previous post I intentionally wasn’t writing the whole code example from the book as I thought that since everyone in this forum talks about examples from this book then everyone has it. But OK, here it is:
-(NSArray *)odds {
static NSMutableArray *odds = [[NSMutableArray alloc] init];
int i = 1;
while ([odds count] < 30) {
[odds addObject:[NSNumber numberWithInt:i]];
i += 2;
}
return odds;
}
If this method had the type (void) then it would be logical to put the array pointer as static. But the method is not of (void) type, that is why I don’t understand why we need it to be static. I am still new to Objective-C so I might be missing something.
Best regards,
Igor