Created
January 28, 2017 15:51
-
-
Save louisbuchbinder/7a71e87d3081227a8514ba5b05b42fd9 to your computer and use it in GitHub Desktop.
Code Golf
This file contains 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
// && | |
if (true && true && true) // TRUTHY | |
if (true * true * true) // using multiplication converts true to 1 and multiplies each 1 together, (1 * 1 * 1) which evaluates to a truthy value | |
if (true && true && false) // FALSY | |
if (true * true * false) // (1 * 1 * 0) FALSY | |
// || | |
if (true || false || false) // TRUTHY | |
if (true + false + false) // (1 + 0 + 0) TRUTHY | |
if (true || true || false) // TRUTHY | |
if (true + true + false) // (1 + 1 + 0) TRUTHY | |
if (false || false || false) // FALSY | |
if (false + false + false) // (0 + 0 + 0) FALASY | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment