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: ...
Get Get Programming with F# now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.