Skip to content

Instantly share code, notes, and snippets.

@gyselph
Created January 15, 2021 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gyselph/479ab90cd2d8651fd1f4b099786ab119 to your computer and use it in GitHub Desktop.
Save gyselph/479ab90cd2d8651fd1f4b099786ab119 to your computer and use it in GitHub Desktop.
Java 7 to 15: old switch
jshell> var i = 3
jshell> String s;
jshell> switch(i) {
...> case 1: s = "one"; break;
...> case 2: s = "two"; break;
...> case 3: s = "three"; break;
...> default: s = "unknown number";
...> }
jshell> s
s ==> "three"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment