Match Statement in F#

Published on August 10, 2014 by abundantcode

Filed under F#

Last modified December 24, 2014

Print this page

rate 1 star rate 2 star rate 3 star rate 4 star rate 5 star
Your rating: none, Average: 3 (1 votes)

This article have been viewed 3336 times

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

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Comment


x

You might be Interested in these Posts

How to use array Rank in C# ?

In C# , the Rank property of the array is is used to get the rank of the array. In simple terms , ra...

Json.NET & VB.NET - How to Deserialize an Object ?

One of the ways to Deserialize an object to JSON string in VB.NET in the Json.NET is using the DeSer...

Json.NET & VB.NET - How to Serialize an Object ?

One of the ways to serialize an object to JSON string in VB.NET in the Json.NET is using the Seriali...