10.3  Accessing Record Fields

10.3 Accessing Record Fields

Expr#Name.Field

Returns the value of the specified field. Expr is to evaluate to a Name record.

The following expression returns the position of the specified field in the tuple representation of the record:

#Name.Field

Example:

-record(person, {name, phone, address}).

...

lookup(Name, List) ->
    lists:keysearch(Name, #person.name, List).