March 2018
Beginner to intermediate
458 pages
10h 34m
English
The class, struct, union, record, and enum types come under aggregate types. The record type is one of them, it can have n number of members of any individual type. Record type members are by default immutable but we can make them mutable. In general, a record type uses the members as an immutable data type. There is no way to execute logic during instantiation as a record type don't have constructors. A record type also supports match expression, depending on the values inside those records, and they can also again decompose those values for individual handling, for example:
type Box = {width: float ; height:int }let giftbox = {width = 6.2 ; height = 3 }
In the previous example, we declared a Box with float a value width and ...
Read now
Unlock full access