Array.branch()

From ZCubes Wiki
Revision as of 21:47, 21 March 2024 by Joseph (talk | contribs) (→‎Array.branch(SomeOnlyMatches))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Array.branch(fns)

fns can be any arbitrary array of functions. The result will be a similar array as functions evaluated for the array itself.

Split values into [negative, zero and positive] values by default. Returns the true/false of the match result.


[[1,-2],[3,3],[0,44,-44]].branch(true).print()

[ [ [false,true ],

[false,false ],

[false,false,true ] ],

[ [false,false ],

[false,false ],

[true,false,false ] ],

[ [true,false ],

[true,true ],

[false,true,false ] ] ]


[-5..5].branch(true)

true true true true true false false false false false false

false false false false false true false false false false false

false false false false false false true true true true true


[-5..5].branchvalues(true)

branchvalues splits it based on neg, zero and positive, and OnlyMatches will filtered if unmatched.

-5 -4 -3 -2 -1

0

1 2 3 4 5


-10..10.branch([LT,[EQ,GT]]) .print()

See Also

branchvalues