Last active
September 20, 2017 04:40
-
-
Save blackode/9e3d873ad803ef6d4f653d8bf2e1b028 to your computer and use it in GitHub Desktop.
Multiple Or Conditions
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
# Regular Approach | |
find = fn(x) when x>10 or x<5 or x==7 -> x end | |
# Our Hack | |
hell = fn(x) when true in [x>10,x<5,x==7] -> x end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's an interesting usage of
in
and a neat trick.The Regular approach reads much better and requires you to write less code though.