Clojure – Loops

clojure loops

In this guide, we will discuss Clojure Loops. 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
1While Statement
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.
2Doseq Statement
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.
3Dotimes Statement
The ‘dotimes’ statement is used to execute a statement ‘x’ number of times.
4Loop Statement
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

Next Topic : Click Here

This Post Has One Comment

Leave a Reply