Last active
November 12, 2016 02:09
-
-
Save Restuta/51bc17708f0a66b08ba4a41ca7e871fa to your computer and use it in GitHub Desktop.
Cat is alive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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