Erlang - Decision Making


Advertisements


Decision making structures requires that the programmer should specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false.

Following is the general form of a typical decision making structure found in most of the programming languages −

Decision Making

Erlang programming language provides the following types of decision making statements.

Sr.No. Statement & Description
1

If statement

An if statement consists of a Boolean expression followed by one or more statements.

2

Multiple Expression

The if expression also allows for multiple expressions to be evaluated at once.

3

Nested if Statements

You can use one if or else if statement inside another if or else if statement(s).

4

Case Statements

It can be used to execute expressions based on the output of the case statement.



Advertisements