You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/fsharp/language-reference/records.md
+19-1Lines changed: 19 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: Records in F#
3
3
titleSuffix: ""
4
4
description: Learn how F# records represent simple aggregates of named values, optionally with members.
5
-
ms.date: 08/15/2020
5
+
ms.date: 12/21/2021
6
6
---
7
7
# Records (F#)
8
8
@@ -107,6 +107,24 @@ and Address =
107
107
Occupant: Person }
108
108
```
109
109
110
+
To create instances of both, you do the following:
111
+
112
+
```fsharp
113
+
// Create a Person type and use the Address type that is not defined
114
+
let rec person =
115
+
{
116
+
Name = "Person name"
117
+
Age = 12
118
+
Address =
119
+
{
120
+
Line1 = "line 1"
121
+
Line2 = "line 2"
122
+
PostCode = "abc123"
123
+
Occupant = person
124
+
}
125
+
}
126
+
```
127
+
110
128
If you were to define the previous example without the `and` keyword, then it would not compile. The `and` keyword is required for mutually recursive definitions.
0 commit comments