So far we have seen statements which are executed one after the other in a sequential manner. Additionally, statements are provided in Clojure to alter the flow of control in a program’s logic. They are then classified into flow of control statements which we will see in detail.
|Sr.No.||Loops & Description|
The 'while' statement is executed by first evaluating the condition expression (a Boolean value), and if the result is true, then the statements in the while loop are executed.
The ‘doseq’ statement is similar to the ‘for each’ statement which is found in many other programming languages. The doseq statement is basically used to iterate over a sequence.
The ‘dotimes’ statement is used to execute a statement ‘x’ number of times.
The loop special form is not like a ‘for’ loop. The usage of loop is the same as the let binding. However, loop sets a recursion point