ubsequence_-sequence-subsequence-subsequence-subsequence-subsequence-iterator-element-iterator-element-prefix-while_"><div class="p">
    <p>Returns a subsequence containing the initial, consecutive elements that
satisfy the given predicate.</p>

<p>The following example uses the <code>prefix(while:)</code> method to find the
positive numbers at the beginning of the <code>numbers</code> array. Every element
of <code>numbers</code> up to, but not including, the first negative value is
included in the result.