Skip to content

Instantly share code, notes, and snippets.

@gbasile
Created April 30, 2013 08:27
Show Gist options
  • Save gbasile/5487378 to your computer and use it in GitHub Desktop.
Save gbasile/5487378 to your computer and use it in GitHub Desktop.
If/else code
- (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;
}
@joanromano
Copy link

  • (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;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment