Skip to content

Commit

Permalink
fix: remove usage of else statement
Browse files Browse the repository at this point in the history
  • Loading branch information
coolofficials committed Dec 22, 2022
1 parent 22ec96f commit 6a2a872
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/main/java/baseball/Console.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ public String getInput() {
public void printResult(int strike, int ball) {
if (strike + ball == 0) {
System.out.println("낫씽");
} else if (strike == 0) {
System.out.println(ball + " 볼");
} else if (ball == 0) {
System.out.println(strike + " 스트라이크");
} else {
System.out.println(strike + " 스트라이크 " + ball + " 볼");
}
if (strike != 0) {
System.out.printf(strike + " 스트라이크 ");
}
if (ball != 0) {
System.out.printf(ball + " 볼");
}
System.out.println();
}

public int endGame() {
Expand Down

0 comments on commit 6a2a872

Please sign in to comment.