Created
April 30, 2013 08:27
-
-
Save gbasile/5487378 to your computer and use it in GitHub Desktop.
If/else code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSString *)score | |
{ | |
NSString *resultScore = nil; | |
if (self.firstPlayerScore == 3 && self.secondPlayerScore == 3 ) | |
resultScore = @"DEUCE"; | |
else if (self.firstPlayerScore == 4) | |
resultScore = @"GAME PLAYER 1"; | |
else if (self.secondPlayerScore == 4) | |
resultScore = @"GAME PLAYER 2"; | |
else | |
resultScore = [NSString stringWithFormat:@"%@ - %@", [self basicScore:self.firstPlayerScore], [self basicScore:self.secondPlayerScore]]; | |
return resultScore; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
(NSString *)score
{
NSString *resultScore = [NSString stringWithFormat:@"%@ - %@", [self basicScore:self.firstPlayerScore], [self basicScore:self.secondPlayerScore]];
if (self.firstPlayerScore == 3 && self.secondPlayerScore == 3 )
resultScore = @"DEUCE";
else if (self.firstPlayerScore == 4)
resultScore = @"GAME PLAYER 1";
else if (self.secondPlayerScore == 4)
resultScore = @"GAME PLAYER 2";
return resultScore;
}