O'Reilly logo

Mastering F# by Suhaib Fahad, Alfonso García-Caro Núñez

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

Chapter 2. Functional Core with F#

As we have seen, F# is a functional-first language where we create functions and apply them. The result of the evaluation of one of these expressions is a value, and the execution of the program is the evaluation of all the expressions that comprise it.

In this chapter, we will cover the following topics:

  • F# types such as primitives, tuples, records, and unions
  • Pattern matching
  • Equality and comparison
  • Reference cells and mutability

F# primitive types

The data types defined in F# are mapped directly with CLR. The following table defines the F# primitive types:

Name

F# type

Suffix

Example

Boolean

bool

true/false

Character

char

'A'

Text string

string

"Hello World!"

Short

int16

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