July 2023
Intermediate to advanced
670 pages
17h 13m
English
Haskell supports quite a few ways to take different branches in your code. Some, like the venerable if expression will look familiar. Others, like guard clauses might not. In this section, you’ll learn the basics of branching in your program. Later, here, you’ll learn about pattern matching, a powerful technique you can combine with branches to make your code incredibly expressive.
The branching structure that you’re probably most familiar with from other languages is the if expression. Like most other languages, if expressions in Haskell allow you to return one value if some predicate is true, and a different value if the predicate is false. In Haskell, if structures are expressions, meaning that you ...
Read now
Unlock full access