Erlang Central

Difference between revisions of "Records"

From ErlangCentral Wiki

(Added a very rudimentary page about records (since I didn't know how to use them, and there was no page about them on the wiki).)
 
(Added a link to Erlang.org.)
Line 16:Line 16:
 
elementTwoTimesEight( #recordname{ element2 = T } ) -> T * 8.
 
elementTwoTimesEight( #recordname{ element2 = T } ) -> T * 8.
 
</code>
 
</code>
 +
 +
== More Information ==
 +
 +
More information at [http://erlang.org/doc/getting_started/records_macros.html#5.3 http://erlang.org/doc/getting_started/records_macros.html#5.3].

Revision as of 11:08, 15 July 2007

Contents

Defining Records

-record( recordname, { element1, element2, element3 } ).

Creating a Record

R = #recordname{ element1 = "One", element2 = 2, element3 = three }.

Matching a Record

elementTwoTimesEight( #recordname{ element2 = T } ) -> T * 8.

More Information

More information at http://erlang.org/doc/getting_started/records_macros.html#5.3.