Created
March 16, 2019 10:30
-
-
Save ssaurel/24eb6af85df927e05a08673871087e2c to your computer and use it in GitHub Desktop.
Switch Java 12 on the SSaurel's Channel
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
public static boolean boolean isWeekend(String day) { | |
return switch (day) { | |
case "mon", "tue", "wed", "thu", "fri" -> false; | |
case "sat", "sun" -> true; | |
default -> { | |
if (day.startsWith("s")) { | |
System.out.println("It seems to be a weekend day"); | |
break true; | |
} | |
System.out.printf("Unknown day: %s%n", day); | |
break false; | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment