Home » F# Enumerations

F# Enumerations

by Online Tutorials Library

F# Enumerations

Enumerations popularly known as enums. It is a combination of label and value pair. Labels are assigned to a subset of the values. You can use them in place of literals to make code more readable and maintainable.

Syntax:

An enumeration is much like union except that it allows us to specify values.


F# Enumeration Example

You can access enums either by using label name or integer value. Let’s see an example.

Ouput:

April 0 
Next TopicF# Reference Cells

You may also like