O'Reilly logo

Get Programming with F#: A guide for .NET developers by Isaac Abraham

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Lesson 20. Program flow in F#

In C# and VB .NET, we have a variety of ways of performing what I consider program flow: branching mechanisms and, to an extent, loops. In this lesson, we’ll compare and contrast those features with equivalents in F#, looking at the following:

  • for and while loops
  • If/then statements and expressions
  • Switch/case statements
  • Pattern matching

When you’re finished, you’ll have a good idea of how to perform all sorts of complex conditional logic much more succinctly than you might be used to.

20.1. A tour around loops in F#

I cover loops briefly in this lesson because the F# side of things has a slightly different syntax compared to C# and VB .NET, with similar behavior. This leaves us more room to focus on branching ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required