Quote:
Originally Posted by wilky94
i dont get errors but i think you are correct do you know what i could do to fix this
|
Hi. Maybe u can do it like this:
Code:
- (IBAction)A:(UIButton *)sender {
if ([question.text isEqualToString:@"What was the first programmable computer called?"]) {
score.text = [NSString stringWithFormat:@"%i", ([score.text intValue] - 1)];
result.text = @"Incorrect";
return;
}
result.text = @"Correct";
score.text = [NSString stringWithFormat:@"%i", ([score.text intValue] + 1)];
NSLog(question.text);
}
So if the result is wrong, it would deduct 1 point from score and exit the method (using return). Then all the green code is ignored. If it is right, the if statement is ignored, and the green code is executed. I probably use a complete if..else statement.. but im not sure how ur game work. Give the above code a try.