On 05/21/2016 04:39 PM, pineapple wrote:
But I don't understand why. Could someone clarify the difference between
the two?

Common mistake, because other languages (e.g. C#) use similar but different syntax.

The `foo => bar` syntax doesn't use braces. When you add braces around bar, that's a delegate that runs bar when called.

I.e., this:
    foo => bar
is equivalent to this:
    (foo) {return bar;}

And this:
    foo => {bar;}
is equivalent to this:
    (foo) {return () {bar;};}

Reply via email to