Type-Specific Identifiers
This lesson will teach us how to explicitly set the type of our let binding.
We'll cover the following
As we’ve seen so far, keeping track of the type of data we have is very important. Languages like JavaScript or Python do not require that we mention the explicit type of a variable.
In other languages like C++ or Java, we have to specify the type of a variable when declaring it.
Reason has the best of both worlds! In the previous lesson, we saw how let
bindings could automatically detect the data type of a value. However, if needed, we can explicitly specify the data type which our let
binding should have.
Type Annotations
The type of binding can be annotated next to the name of the identifier, preceded by the :
keyword:
Get hands-on with 1400+ tech skills courses.