Skip to content

Instantly share code, notes, and snippets.

@blackode
Last active September 20, 2017 04:40
Show Gist options
  • Save blackode/9e3d873ad803ef6d4f653d8bf2e1b028 to your computer and use it in GitHub Desktop.
Save blackode/9e3d873ad803ef6d4f653d8bf2e1b028 to your computer and use it in GitHub Desktop.
Multiple Or Conditions
# 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
@brayhoward
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment