@find
Return the first element that satisfies the predicate.
Returns: any
Syntax
Section titled “Syntax”@find(arr fn)Arguments
Section titled “Arguments”| Name | Type | Description |
|---|---|---|
arr |
array |
Source array |
fn |
helper |
Predicate helper returning bool |
Examples
Section titled “Examples”# Find first even numberdef @isEven "$n: number -> bool" @bool(@num($n % 2) == 0)set $nums [1 3 4 6]set $first @find($nums @isEven)