TAKEWHILE

Returns an array consisting of all items from the beginning of an array which satisfy the specified condition.

Syntax

=TAKEWHILE(array, test)

Arguments

ArgumentTypeDescription
arrayArrayThe array of values
testLambdaTest to perform on each item of the array to determine if the item is included

Examples

=TAKEWHILE([1, 3, 5, 2, 4, 6, 1], x => ISODD(x))→[1, 3, 5]

=TAKEWHILE(["A", "B", "C", "d", "E", "f"], x => UPPER(x) = x)["A", "B", "C"]