Instructor: Let's get started with the language basics. We already have seen 1 + 1, and if we try 1.1 + 2.2, it will fail since there's a special operator for adding float values.
The operators minus, multiply, divide, and module only work for integers. For float, they do as well, if the operator is followed by a dot. To compare values, we can use several relational operators, or structural equality using two equal signs.
If you try to compare values of a different type, for example, an integer and a float, it won't work. We can convert an integer to a float using floatofint.
In fact, Reason ships a good amount of such utility functions for converting types. All follow the same pattern with destinationtype_of_sourcetype, and the value as a parameter. For example, pool_of_string.
There we are at our next data type, Boolean. It's pretty straight-forward, as it only can be true or false. Boolean operators are not, and, as well as or.
Strings are also straight-forward. They are limited using double quotes. Strings can be concatenated using two plus signs, and we can also create multi-line strings.
While we also can do one-letter strings, Reason comes with a special data type for a single letter, char, for character. We can create one by using single quotes.
This special value has its own type unit, and it's the only element of that type. Therefore, we can't leverage it to make it type-nullable simply because the type unit is not compatible to any other type. As you can see, this isn't valid, and the compiler froze in error.
Unit can be used in many cases. One of them would be for functions with side effects don't return anything. For example, print integer.