List.filter
filter($callbackFunction) -> list
Description
Keep or remove items in the List.
If the callback returns true
, the item is kept in the List. Otherwise, it is removed.
Returns a List of filtered items.
(This example uses Expression Function notation x{...}
.)
[1, -2, 3, -4, 5].filter(x{ $a > 0 }) //= [1, 3, 5]