First, we defined a data type called Days. It has seven alternative values (Sunday to Saturday). The Days type can take, at the most, seven values.
Next, we defined a data type called Variant. The Variant data type is classified by five type arguments. In the example, we used Int, Float, Double, Char, and String. The data type defines constructors Variant1 ... Variant5 with a field each corresponding to one type. At the same type, we also have a constructor Variant0, which does not have a field at all. Hence, the number of possible types that Variant can take is the sum of all possible values that each type can take. Additionally, we have to add one value for Variant0.
Since the number of possible values is the sum of ...
With Safari, you learn the way you learn best. Get unlimited access to videos, live online training,
learning paths, books, interactive tutorials, and more.