F# – Loops

  • Post author:
  • Post category:F#
  • Post comments:0 Comments
F# - Loops

F# Loops 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 the following is the general form of a loop statement in most programming languages −

F# - Loops

F# provides the following types of loops to handle the looping requirements.

Sr.NoLoop Type & Description
1for… 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 the loop variable).
2for … in expression (This form of for loop is used to iterate over collections of items i.e., loops over collections and sequences)
3While…do loop (Repeats a statement or group of statements while a given condition is true. It tests the condition before executing the loop body).
4nested loops (You can use one or more loops inside any other for or while loop).

Next Topic – Click Here

Leave a Reply