Navigation: Developing Apps > BINETIX® AGE™ API > The Node > Toolkits > age_lists
get_value/3
Description
get_value/3 is an Erlang function exported by "age_lists" module.
Returns the value of a key/value property within a List. If Key is not found then returns {error, key_not_found}.
References
None
Parameters
Name
Type
Key
atom()
Key name.
Input
list()
Input list of terms.
DefaultValue
any()
Optional default value when Key is not found within the input list.
Result
Value or Type
any() | {error, key_not_found}
On success returns the value of a key.
Code Sample
> age_lists:get_value(c, [{a, 1}, {b, 2}, {c, 3}]). 3 > age_lists:get_value(z, [{a, 1}, {b, 2}, {c, 3}]). {error, key_not_found} > age_lists:get_value(z, [{a, 1}, {b, 2}, {c, 3}], 4). 4 > age_lists:get_value(z, [{a, 1}, {b, 2}, {c, 3}], undefined). undefined