Elixir Decision Making-If statement - Elixir

What is the use of if statement in Elixir?

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

Syntax

Below is the syntax for if statement:

If the Boolean expression evaluates to true, then the block of code inside the if statement will be executed. If Boolean expression evaluates to false, then the first set of code after the end keyword of given if statement will be executed.

Flow Diagram

if_statement.jpg

Example

While running above program, it produces following result:

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Elixir Topics