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 7. Expressions and statements

Expressions and statements are two aspects of programming that we use often, and generally take for granted, but in F# the distinction between the two is much starker than you might be used to. In this lesson, you’ll do the following:

  • Explore the differences between statements and expressions
  • Lean the pros and cons of both
  • See how expressions in combination with the F# type system and compiler can help you write code that’s more succinct as well as easier to reason about

7.1. Comparing statements and expressions

Before we dive in, let’s quickly recap the definitions of statements and expressions. Here are two definitions taken directly from the C# documentation on MSDN—first statements, and then expressions: ...

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