. (full stop)
Gives access to the members of a structure.
Syntax
-
S.x
-
S
is a structure -
x
is a symbol, the name of a member ofS
-
The returned value is an lvalue.
Description
If S
is a structure and x
the name of a member of S
(as a symbol, not as a string), then S.x
returns the value of this member in S
.
S.x
is an lvalue if S
is; if so, S.x
may be assigned to.
The .
operator is implemented by the internal FCN_AccessMember
function. This function is not exported with a name. Therefore, it can only be used via this operator.
Examples
Albus ≔ struct("FirstName": "Albus", "LastName": "Dumbledore", "Age": 105, "Role": "Headmaster")
FirstName: Albus LastName: Dumbledore Age: 105 Role: Headmaster
Albus.LastName
Dumbledore
Albus.Age ≔ 106
106
Albus
FirstName: Albus LastName: Dumbledore Age: 106 Role: Headmaster
now().date.year
2020
now().date.year ≔ 1995
failure
Left side cannot be assigned to.
Call stack: assign