The if-else Expression

This lesson will teach us how to create if-else expressions in Reason syntax.

The if condition is one of the most relevant statements in the world of computer programming. It is supported in many popular languages such as Java, C++, and Python. The condition is used to execute certain operations if a condition is fulfilled.

The else keyword is derived from if. We’ll understand more about this later in the lesson.

Let’s talk about the structure of the if-else expression.

The Structure

The structure of Reason’s if-else expression is fairly similar to the one followed in other languages. it can be divided into 3 parts:

  1. The if condition
  2. The expression to be executed
  3. The else expression

Get hands-on with 1200+ tech skills courses.