ELIXIR Pattern match a map - Computer Programming

Latest

C C++ Java Python Perl Programs Examples with Output -useful for Schools & College Students

Thursday, September 28, 2017

ELIXIR Pattern match a map

Pattern match a map

Program:

%{ b: value, d: value2 } = %{ a: 1, b: 2, d: 3 }

# Matches keys on the left side
# There may be more keys on the right side
%{ a: value } = %{ a: 1, b: 2, d: 3 }

# raises a match error if key is missing
%{ c: value } = %{ a: 1, b: 2 }

No comments:

Post a Comment