Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 787
davis Avatar asked Feb 03 '26 04:02

davis


1 Answers

You have to wrap your if statement between parentheses.

if (([currentClass rangeOfString:@"English"].location != NSNotFound) || ([currentClass rangeOfString:@"Literature"].location != NSNotFound)) {
like image 163
Simon Avatar answered Feb 05 '26 21:02

Simon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!