Last active
August 29, 2015 14:05
-
-
Save masteinhauser/708e1df865911662815a to your computer and use it in GitHub Desktop.
Elixir: Match two fields of a struct against each other in a function definition
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
def foo(%State{attempted_address} = address, bar)) when address not nil do | |
# a thing, do it here | |
end | |
def foo(%State{address} = address, bar)) when address not nil do | |
# a thing, do it here | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't think
is valid... I get a compile error