Functional programming
C# is a general-purpose and multi-paradigm programming language. Yet, so far in this book, we have only covered the imperative programming paradigm, which uses statements to change the program state and is focused on describing how a program operates. In imperative programming, functions may have side effects, thus changing the program state when they execute. Alternatively, the execution of a function may depend on the program state.
The opposite paradigm is functional programming, which is concerned with describing what a program does and not how it does it. Functional programming treats computation as the evaluation of functions; it uses immutable data and avoids changing states. Functional programming is a declarative programming paradigm where expressions are used instead of statements. Functions no longer have side effects but are idempotent. This means that calling a function with the same arguments produces the same results every time.
Functional...