The option Type

Let's learn about what the option variant type is in Reason.

What is the option Type?

In theory, Reason does not have nullable types. Such types can have a value of null or in other words, nothing.

We’ll never see a null int or string object. They must always contain some value.

However, sometimes, we need to cater for an identifier that has a null value. Reason’s solution to this problem is the option type.

The option is a variant type which allows an object to have some value or no value at all.

The Structure

An option consists of two parts:

Get hands-on with 1400+ tech skills courses.