F# is a functional-first language for the .NET platform. It infers most types for you, makes values immutable by default, and uses indentation rather than braces, so programs stay short and readable. You model a domain with records and discriminated unions, branch on them with pattern matching, and chain transformations with the pipe operator |>. Missing values use Option instead of null, and failures can be returned as Result. Because it runs on .NET, F# can use any C# library, and scripts run instantly in F# Interactive with dotnet fsi. Learnr turns F# into a personalized course of bite-sized, interactive lessons.
How to learn F#, step by step
- Install the .NET SDK and use F# scripts. Install the .NET SDK and an editor with F# support, such as VS Code with Ionide, Visual Studio or Rider. Write .fsx scripts and run them with dotnet fsi so you can experiment without creating a project.
- Learn let, functions and pipelines. Bind values with let, write small functions, and chain them with |> so data flows left to right, like numbers |> List.filter isEven |> List.sum. Notice how rarely you need to write a type.
- Model a domain with types. Describe a payment as a discriminated union of Card, Cash and Voucher cases, each carrying its own data, and use records for fixed shapes. The compiler then warns you when a match forgets a case.
- Replace null and exceptions with types. Return Option when a value may be missing and Result when an operation can fail, then combine them with Option.map, Result.bind and pattern matching. This keeps error paths visible in every signature.
- Create projects and mind file order. Use dotnet new console -lang F# to start a project. F# compiles files in the order listed in the .fsproj, so a file can only use code from files above it, which shapes how you organize modules.
- Use .NET libraries and write tests. Call C# libraries directly, use task and async computation expressions for I/O, and write tests with Expecto or xUnit. Short Learnr lessons each day keep pattern matching and union types fresh.
What you'll learn
- Write F# with let bindings, functions and the pipe operator
- Model domains with records and discriminated unions
- Branch on data with exhaustive pattern matching
- Handle missing values and errors with Option and Result
- Build, test and run F# projects and scripts with the dotnet CLI
How long does it take to learn F#?
A C# developer can write useful F# in 2 to 4 weeks at 5 hours a week. Coming from dynamic languages, plan on 2 to 3 months to get comfortable with types, pattern matching and functional design. Experience with Haskell or OCaml shortens it.
What you need before you start
Some programming experience in any language. Familiarity with C# or .NET helps with tooling and libraries, but it is not required to learn the language itself.
Common mistakes to avoid
- Writing C# in F# syntax with mutable variables and classes everywhere. Start with immutable values, records and unions, adding mutation only where it helps.
- Getting compile errors because a file uses code defined in a file listed later in the project. Order files in the .fsproj from dependencies to consumers.
- Using exceptions for expected failures like invalid input. Return Result so callers have to handle the failure case.
How Learnr builds your course
Type your topic
Tell Learnr you want to learn F#, or get as specific as you like.
Get a personalized course
Learnr instantly builds a full F# course tailored to your goal and skill level.
Learn and level up
Move through bite-sized lessons and interactive practice, earning XP and keeping your streak.
F# questions, answered
Is F# the same as C#?
No. Both run on .NET and can share libraries, but F# is functional-first with type inference, immutability and discriminated unions, while C# is primarily object-oriented.
Can F# be used for web development?
Yes. You can build web APIs on ASP.NET Core with F#, and Fable compiles F# to JavaScript for frontend code.
Is F# good for data and scripting?
Yes. F# scripts and notebooks are well suited to exploring data, and type providers can generate types from sources like CSV or JSON files.
Explore more courses
More programming and tech courses
- Learn Microsoft Azure
- Learn Google Cloud
- Learn Ansible
- Learn CI/CD
- Learn MySQL
- Learn Nginx
- Learn Web Scraping
- Learn Cryptography
See all programming and tech courses
Ready to learn F#?
Start your free, personalized F# course in seconds. It will be typed in and ready when you get there.
Start learning F#Free to start. No credit card.