Skip to content

Instantly share code, notes, and snippets.

@qhwa
Created July 30, 2020 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qhwa/bf5b5423157419b3b625f29149c6edd9 to your computer and use it in GitHub Desktop.
Save qhwa/bf5b5423157419b3b625f29149c6edd9 to your computer and use it in GitHub Desktop.
Check numbers
use Bitwise
even? = fn number ->
(number &&& 1) == 0
end
0..20
|> Enum.filter(even?)
#=> [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment