Else if, or statement in Xcode. Not sure what I'm doing wrong

15,785

Solution 1

You're missing an extra set of parentheses for the entire if().

Solution 2

You have to wrap your if statement between parentheses.

if (([currentClass rangeOfString:@"English"].location != NSNotFound) || ([currentClass rangeOfString:@"Literature"].location != NSNotFound)) {
Share:
15,785
davis
Author by

davis

SOreadytohelp

Updated on June 05, 2022

Comments

  • davis
    davis almost 2 years

    I'm not sure what I'm doing wrong, but Xcode keeps saying "Expected expression". What is wrong with the else if, or statement below?

    else if ([currentClass rangeOfString:@"English"].location != NSNotFound) || ([currentClass rangeOfString:@"Literature"].location != NSNotFound) {
        cell.imageView.image = [UIImage imageNamed:@"englishicon.png"];
    
    }
    

    Thanks for your help