天天看點

[Kotlin] When to add () and when not to

Let's see following code:

Why in "reduce" we don't need to add ()

but in "filter" example we need?

Answer is in "reduce" it is a function take two params, which doesn't require ()

in "filter" it means destructing, in fact, you can write: