You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* kotlin-tour-functions.md : fix filter predicate explanation
The predicate doesn't do the filtering, .filter() does
* Apply suggestions from code review
Co-authored-by: Sarah Haggarty <[email protected]>
---------
Co-authored-by: Sarah Haggarty <[email protected]>
The `.filter()` function accepts a lambda expression as a predicate:
399
+
The `.filter()` function accepts a lambda expression as a predicateand applies it to each element of the list. The function keeps an element only if the predicate returns `true`:
400
400
401
-
* `{ x -> x >0 }` takes each element of the list and returns only those that are positive.
402
-
* `{ x -> x <0 }` takes each element of the list and returns only those that are negative.
401
+
* `{ x -> x >0 }` returns `true` ifthe element is positive.
402
+
* `{ x -> x <0 }` returns `true` ifthe element is negative.
403
403
404
404
This example demonstrates two ways of passing a lambda expression to a function:
0 commit comments