Skip to content

Instantly share code, notes, and snippets.

@oyvindkinsey
Created January 19, 2011 16:22
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 oyvindkinsey/786393 to your computer and use it in GitHub Desktop.
Save oyvindkinsey/786393 to your computer and use it in GitHub Desktop.
How to make 'if x <= foo, else if x <= faa' statments elegant..
var a = 23;
switch (true){
case a <= 25:
//do foo
break;
case a <= 30:
// do faa
break;
default:
// foobar
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment