decision-making structures require that the programmer 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.
| sr.no. | methods & description |
|---|---|
| 1 |
if statement
in clojure, the condition is an expression which evaluates it to be either true or false. 'if' the condition is true, then statement#1 will be executed, else statement#2 will be executed. |
| 2 |
if/do expression
the ‘if-do’ expression in clojure is used to allow multiple expressions to be executed for each branch of the ‘if’ statement. |
| 3 |
nested if statement
multiple 'if' statements embedded inside each other. |
| 4 |
case statement
clojure offers the ‘case’ statement which is similar to the ‘switch’ statement available in the java programming language. |
| 5 |
cond statement
clojure offers another evaluation statement called the ‘cond’ statement. this statement takes a set of test/expression pairs. |