filter() Function

Calls a predicate for each item in a list and returns any items for which the returned value is true.

Syntax

filter( predicate, list, [context, … ] )

predicate: (Function, Rule, or Data Type Constructor) Expression that returns a Boolean (true or false).

list: (Any Type Array) List of elements that the predicate iterates through.

context: (Any Type Array) Variable number of parameters passed directly into each predicate evaluation.

Returns

Any Type Array

Notes

Use fn!functionName to reference an expression function and rule!ruleName to reference a rule.

a!forEach() cannot be used within rules used in this function.

Examples

filter(fn!iseven,{-1,0,1,2},1) returns 0, 2

Open in Github Built: Thu, Feb 23, 2023 (02:59:22 PM)

On This Page

FEEDBACK