List.RemoveFirstN

About

Returns a list with the specified number of elements removed from the list starting at the first element. The number of elements removed depends on the optional countOrCondition parameter.

Syntax

List.RemoveFirstN( table as table, optional countOrCondition as any) as table  

Arguments

Argument Description
list The List to remove items from.
optional countOrCondition Optional number of elements or condition to remove elements, default is 1

Remarks

  • If countOrCondidtion is omitted only the first element is removed

  • If countOrCondidtion is a number, that many elements (starting from the top) will be removed)

  • If countOrCondidtion is a condition, the elements that meet the condition will be removed until an element does not meet the condition

Examples

List.RemoveFirstN  

    (  

    {1, 2, 3, 4, 5},  

    3  

    )  

equals {4, 5}  

List.RemoveFirstN  

    (  

    {5, 4, 2, 6, 1},  

    each _ > 3  

    )  

equals { 2, 6, 1}