DEV Community

Discussion on: Mere Functional Programming in F#

Collapse
 
saint4eva profile image
saint4eva

int Add(int a, int b) => a + b;

Collapse
 
kspeakman profile image
Kasey Speakman • Edited

This expression bodied syntax in C# is only available if the method is a single statement. Once you go beyond a single statement, you have to use curly braces and return. It’s a handy shortcut when you can use it, but it is not the typical C# experience. The F# code could be shorter as well: let add = (+)

However, the example in the article is demonstrating the structure that you will usually see in each language, not the shortest possible representation of that specific code.

Collapse
 
saint4eva profile image
saint4eva

Okay.