F# provides the following types of loop:
Loop type |
Description |
for…to and for…downto expressions |
The for...to expression is used to iterate in a loop over a range of values of a loop variable. The for…downto expression reduces the value of a loop variable. |
for…in expression |
This form of for loop is used to iterate over collections of items; that is, loops over collections and sequences. |
while…do loop |
Repeats a statement or group of statements while the given condition is true. It tests the condition before executing the loop body. |
nested loops |
We can use one or more loop inside any other for or while loop. |