The question might seem a bit confusing but I have an if statement that looks something like this
if ([textAnswer.text isEqualToString:@"Fish"])
{
wrong.textColor = [UIColor greenColor];
wrong.text = @"Correct";
} else {
wrong.textColor = [UIColor redColor];
wrong.text = @"Wrong, try again";
}
Is there an easy way to have it equal to two strings, i.e. it will be correct if they enter Fish or Chips in the textAnswer field?
I have tried entering it like this
([textAnswer.text isEqualToString:@"Fish",@"Chip"])
but Xcode flags up an error saying only one statement not two.
Thanks
It needs to be two comparisons and the combined sense of their results:
if ([textAnswer.text isEqualToString:@"Fish"] || [textAnswer.text isEqualToString:@"Chips"]).