I'm trying to make an if statement like this:
if ([myString isEqualToString:@"string"] && myint == 3 || myint == 2) {...}
What that basically is, it's making sure the strings are equal. Then, either myint can be equal to 2 or 3.
When I try doing that, I get an error saying '&&' withing '||'. It suggest putting parenthesis around the && statement like this:
if (([myString isEqualToString:@"string"] && myint == 3) || myint == 2)
My question is, why can't I do it without the parenthesis. And what do the parenthesis do?
Aucun commentaire:
Enregistrer un commentaire