Can't complete challenge 2 :(


#1

I can’t seem to compare those two for-loops…
how do u think i can do that… and is it that bad i couldn’t find the answer cuz i feel so stupid about it :frowning:

#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{

    @autoreleasepool {
        
        NSString *nameString = [NSString stringWithContentsOfFile:@"/usr/share/dict/propernames"
                                                    encoding:NSUTF8StringEncoding
                                                       error:NULL];
        NSString *wordString = [NSString stringWithContentsOfFile:@"/usr/share/dict/words"
                                                    encoding:NSUTF8StringEncoding
                                                       error:NULL];
        NSArray *name = [nameString componentsSeparatedByString:@"\n"];
        NSArray *word = [wordString componentsSeparatedByString:@"\n"];
        
        for (NSString *n in name) {
            NSRange match = [n rangeOfString:@"wolf" options:NSCaseInsensitiveSearch];
            if (match.location != NSNotFound) {
                NSLog(@"name string found %@", n);
                break;
            }
        }
        
        for (NSString *w in word) {
            NSRange match2 = [w rangeOfString:@"wolf" options:NSCaseInsensitiveSearch];
            if (match2.location != NSNotFound) {
                NSLog(@"word string found %@", w);
                break;
            }
          }
        
     
    return 0;
}
}

#2

anyone ?