Skip to content

Instantly share code, notes, and snippets.

@ssaurel
Created March 16, 2019 10:30
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Switch Java 12 on the SSaurel's Channel
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