Skip to content
Yasser Moradi edited this page Aug 24, 2015 · 2 revisions

Description:

SkipWhile is the opposite of TakeWhile. Again a predicate is specified but this time items that meet the condition are skipped. When an item is encountered that causes the predicate to return false, this item and all that follow it are returned.

Samples:

let fruits = ['Apple', 'Banana', 'Cherry', 'Damson', 'Elderberry', 'Grape', 'Kiwi', 'Lemon', 'Melon', 'Orange'];

console.log('SkipWhile method continues skiping items unti string length be bigger or equal than 10 then return remaining items ...');
let skipWhilePartitioned = fruits.asEnumerable().skipWhile(f => f.length < 10).toArray();
for (let index = 0; index < skipWhilePartitioned.length; index++)
  console.log(skipWhilePartitioned[index]);
Clone this wiki locally