mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 06:38:43 +02:00
Autogenerate missing docs (#3514)
* Autogenerate missing docs * Update ansi.md * Rename question mark command docs * Delete empty?.md
This commit is contained in:
34
docs/commands/for.md
Normal file
34
docs/commands/for.md
Normal file
@ -0,0 +1,34 @@
|
||||
# for
|
||||
Run a block on each row of the table.
|
||||
|
||||
## Usage
|
||||
```shell
|
||||
> for <var> <in> <value> <block> {flags}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
* `<var>` the name of the variable
|
||||
* `<in>` the word 'in'
|
||||
* `<value>` the value we want to iterate
|
||||
* `<block>` the block to run on each item
|
||||
|
||||
## Flags
|
||||
* -h, --help: Display this help message
|
||||
* -n, --numbered: returned a numbered item ($it.index and $it.item)
|
||||
|
||||
## Examples
|
||||
Echo the square of each integer
|
||||
```shell
|
||||
> for x in [1 2 3] { $x * $x }
|
||||
```
|
||||
|
||||
Work with elements of a range
|
||||
```shell
|
||||
> for $x in 1..3 { $x }
|
||||
```
|
||||
|
||||
Number each item and echo a message
|
||||
```shell
|
||||
> for $it in ['bob' 'fred'] --numbered { $"($it.index) is ($it.item)" }
|
||||
```
|
||||
|
Reference in New Issue
Block a user