Match Statement in F#


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

Match Statement is similar to switch statement in C# . Below is a sample code snippet demonstrating the use of Match statement in F#.

Match Statement in F#

// AbundantCode F# Tutorials and Code snippets
open System
[<EntryPoint>]
let main argv =
    let value1 = 10
    match value1 with
        | 5 -> Console.WriteLine("Value is 5")
        | 10 -> Console.WriteLine("Value is 10")
        | _ -> Console.WriteLine("Default Value")
    let retval = Console.ReadLine()
    0 // return an integer exit code
Newsletter Signup

Subscribe to our weekly newsletter below and never miss the latest product or an exclusive offer.

Newsletter Signup

Subscribe to our weekly newsletter below and never miss the latest product or an exclusive offer.

%d bloggers like this: