W3cubDocs

/Nushell

while for core

Conditionally run a block in a loop.

Signature

> while {flags} (cond) (block)

Parameters

  • cond: condition to check
  • block: block to loop if check succeeds

Input/output types:

input output
nothing nothing

Examples

Loop while a condition is true

>mutx=0;while$x<10 { $x=$x+1 }

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/while.html