78
F# Structures
F# structure is a data structure which is used to organize data. It is value type and efficient than class. It does not allow let binding. You must declare fields by using val keyword. It allows defining fields but does not allow initialization. You can create constructors, mutable and immutable fields in structure.
Syntax:
F# Structure Example
Here, we have created a Book structure which contains book’s details.
Output:
-------------------------Book's Details------------------------- Title : FSharp Programming Author : Chris Smith Price : $100.00
Next TopicF# Discriminated Unions