Skip to content

Instantly share code, notes, and snippets.

@Restuta
Last active November 12, 2016 02:09
Show Gist options
  • Select an option

  • Save Restuta/51bc17708f0a66b08ba4a41ca7e871fa to your computer and use it in GitHub Desktop.

Select an option

Save Restuta/51bc17708f0a66b08ba4a41ca7e871fa to your computer and use it in GitHub Desktop.
Cat is alive
var catIsAlive = catOnMars.isAlive(); //very expensive operation to check if cat is alive on Mars, we don't want to perform it twice
reportCatStatus({ catIsAlive })
if (catIsAlive) {
doOtherStuff();
}}
// below is for twitter discussion, ignore it if you don't know what is it about
//------------------------
// another way
var alive = catOnMars.isAlive(); //very expensive operation to check if cat is alive on Mars, we don't want to perform it twice
reportCatStatus({ alive })
if (alive) {
doStuff();
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment