programming languages provide various control structures that allow for more complicated execution paths.
a loop statement allows us to execute a statement or group of statements multiple times and following is the general form of a loop statement in most of the programming languages −
f# provides the following types of loops to handle the looping requirements.
| sr.no | loop type & description |
|---|---|
| 1 |
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 loop variable. |
| 2 |
this form of for loop is used to iterate over collections of items i.e., loops over collections and sequences |
| 3 |
repeats a statement or group of statements while a given condition is true. it tests the condition before executing the loop body. |
| 4 |
you can use one or more loop inside any other for or while loop. |