I’m using the next code to check if string is not equal to value :
if (![myString isEqualToString:@"text1"])
//DO SOMETHING
now i’m trying to compare 2 or more strings with this code:
if (![myString isEqualToString:@"text1"] || ![myString isEqualToString:@"text2"])
//DO SOMETHING
and it’s not working…when i separate it to 2 IF statements its working, what’s wrong here?
Use:
But there is something odd with this logic. If it’s not
text1or it’s nottext2is always guaranteed to be true since it can’t be both at once. I would strongly encourage you to review your logic condition.It sounds to me like you want to check if it’s neither
text1ortext2, in which case the code should be: