> int result = some_variable switch { a => callAFunctionReturningVoid(); 1, b => 2, };
What does it even mean? Multi-statement lambdas without return statement, I get it, but what is the return value? And returning a void to int? How is it all supposed to work? What the trailing comma means? Inconsistent way of dealing with things that may confuse developers just results in that proposal resisted.
It is not a lambda but a switch expression. The tricky bits here are separating a call and the returned expression with ;. The trailing comma is just sugar to allow for another case
Understood. You want to escape curly braces and let the last expression be the returned one. F# does implicitly return the last expression.
> The expression is the body of the function, the last expression of which generates a return value. Examples of valid lambda expressions include the following:
What does it even mean? Multi-statement lambdas without return statement, I get it, but what is the return value? And returning a void to int? How is it all supposed to work? What the trailing comma means? Inconsistent way of dealing with things that may confuse developers just results in that proposal resisted.