Match Statement in F#

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
Tags :

Leave Your Comment

Liked this content?. Please spread the word :)