Different Types of For Loops in F#

This content was proof-read by Grammarly. You can Try Grammary for FREE

F# supports 3 different types of For Loops . These include

  • For…to – This is  astandard for loop
  • For .. In – This is similar to For Each in C#
  • for…downto

Different Types of For Loops in F#

Below is a code snippet demonstrating the different For Loops in F#

Are you a .NET Developer planning to integrate GraphQL for .NET in your Application? Check out this book
// AbundantCode F# Tutorials and Code snippets
open System
let main argv =
    // For Loops in F#
    for indexer = 10 to 50 do
    for indexer = 50 downto 10 do
    for indexer in [10..50] do
    let retval = Console.ReadLine()
    0 // return an integer exit code
%d bloggers like this: