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 6712 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

Leave a Comment


x

You might be Interested in these Posts

Video - Angular Router - Brian Ford

Video - Angular Router - Brian Ford http://www.youtube.com/watch?v=sfV0ApyN5fM ...

Video - An Angular2 Todo App: First look at App Development in Angular2

In this screencast , David East , one of the core contributor of the Angular provides a glimpse of A...

Video - Getting started with Angular 2

In this screencast , Alex Eagle , developer on the Angular team talks about Angular 2 developer prev...