...

/

Solution Review: Mutable Nested Fields

Solution Review: Mutable Nested Fields

This lesson explains the solution to the mutable nested fields exercise.

We'll cover the following...

Solution

Press + to interact
type placeDetails = {
house: string,
mutable population: int
}
let placeDetails = {
house: "Stark",
population: 500000
};
type place = {
name: string,
placeDetails: placeDetails
};
let winterfell = {
name: "Winterfell",
placeDetails
};
winterfell.placeDetails.population = 100000;
Js.log(winterfell.placeDetails.population);

Explanation

The ...