10.3 Accessing Record Fields

  1. 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:

  1. #Name.Field

Example:

  1. -record(person, {name, phone, address}).
  2.  
  3. ...
  4.  
  5. lookup(Name, List) ->
  6. lists:keysearch(Name, #person.name, List).