Simple example
A record is created with
square brackets. Note the name/value pairs and that a record is not an array/
list (as in other languages where an array is denoted with square brackets):
[
num = 42,
txt = "Hello world",
dat = #date(2021, 4, 11)
]
Note that Excel for a reason chooses to display the date type as number rather than formatted as date.
If R
is a record, the expression R[fieldName]
gets the value of the record's field whose name is fieldName
.
The following example evaluates to "Hello world"
:
let
R = [
num = 42,
txt = "Hello world"
]
in
R[txt]