[erlang-questions] The way of accessing record's attributes.

Alex Feng sweden.feng@REDACTED
Tue Nov 8 14:12:35 CET 2016


Hi,

Does anyone know why erlang has to attach the record's name to be able to
access an attribute ?
I don't understand, for example, the record "#robot" has been assigned to
variable "Crusher", why do we have to use  "Crusher#robot.hobbies" instead
of "Crusher.hobbies" ?


5> Crusher = #robot{name="Crusher", hobbies=["Crushing people","petting
cats"]}.
#robot{name = "Crusher",type = industrial,
hobbies = ["Crushing people","petting cats"],
details = []}
6> Crusher#robot.hobbies.
["Crushing people","petting cats"]


Br,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20161108/818f1775/attachment.htm>


More information about the erlang-questions mailing list