Get a value from nested maps Using Elixir Program - Computer Programming

Latest

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

Thursday, September 28, 2017

Get a value from nested maps Using Elixir Program

The get_in function can be used to retrieve a nested value in nested maps using a list of keys.

PROGRAM:

nested = %{ one: %{ two: 3} }

3 = get_in(nested, [:one, :two])

# Returns nil for missing value
nil = get_in(nested, [:one, :three])

No comments:

Post a Comment