Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

skip while for filters

Skip elements of the input while a predicate is true.

Signature

> skip while {flags} (predicate)

Parameters

  • predicate: The predicate that skipped element must match.

Input/output types:

inputoutput
tabletable
list<any>list<any>

Examples

Skip while the element is negative

> [-2 0 2 -1] | skip while {|x| $x < 0 }
╭───┬────╮
│ 0 │  0 │
│ 1 │  2 │
│ 2 │ -1 │
╰───┴────╯

Skip while the element is negative using stored condition

> let cond = {|x| $x < 0 }; [-2 0 2 -1] | skip while $cond
╭───┬────╮
│ 0 │  0 │
│ 1 │  2 │
│ 2 │ -1 │
╰───┴────╯

Skip while the field value is negative

> [{a: -2} {a: 0} {a: 2} {a: -1}] | skip while {|x| $x.a < 0 }
╭───┬────╮
│ # │ a  │
├───┼────┤
│ 0 │  0 │
│ 1 │  2 │
│ 2 │ -1 │
╰───┴────╯