Skip to content

Instantly share code, notes, and snippets.

@poemdexter
Created July 1, 2016 02: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 poemdexter/7816a18bd1673ca1b65567a0b6b50eee to your computer and use it in GitHub Desktop.
Save poemdexter/7816a18bd1673ca1b65567a0b6b50eee to your computer and use it in GitHub Desktop.
boolean isValid = true;
if (isValid && expensiveCheck1()) { ... }
if (isValid && expensiveCheck2()) { ... }
// expensiveCheck1() and expensiveCheck2() should set isValid = false if needed to short circuit rest of validations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment