AppleScriptObjC to ObjC help

Hi, does anyone know how to do something with the same effect of

repeat with i in theArray

in ObjC?


It’s a for loop. Example:

for (int currentLocation = 0; currentLocation < [stringToParse length]; currentLocation++) {
    NSString *currentCharacter = [stringToParse substringWithRange:NSMakeRange(currentLocation, 1)];
    [arrayOfChars addObject:currentCharacter];

or this, in the same line as your example:

for (NSNumber *currNumber in secondsArray) {
    // do something

But then you need to know the object’s class for this loop to work, like in this example it is NSNumber. secondsArray is an NSArray of NSNumber objects.

Browser: Safari 534.51.22
Operating System: Mac OS X (10.8)

And if the for … in … form is suitable, it’s also quite a bit quicker.