nushell/docs/commands/empty.md

34 lines
588 B
Markdown
Raw Normal View History

---
title: empty?
layout: command
version: 0.59.0
---
2020-10-06 12:21:20 +02:00
Check for empty values.
2020-10-06 12:21:20 +02:00
## Signature
2020-10-06 12:21:20 +02:00
```> empty? ...rest --block```
2020-10-06 12:21:20 +02:00
## Parameters
2020-10-06 12:21:20 +02:00
- `...rest`: the names of the columns to check emptiness
- `--block {block}`: an optional block to replace if empty
## Examples
2020-10-06 12:21:20 +02:00
Check if a value is empty
2020-10-06 12:21:20 +02:00
```shell
> '' | empty?
2020-10-06 12:21:20 +02:00
```
more than one column
2020-10-06 12:21:20 +02:00
```shell
> [[meal size]; [arepa small] [taco '']] | empty? meal size
2020-10-06 12:21:20 +02:00
```
use a block if setting the empty cell contents is wanted
2020-10-06 12:21:20 +02:00
```shell
> [[2020/04/16 2020/07/10 2020/11/16]; ['' [27] [37]]] | empty? 2020/04/16 -b { |_| [33 37] }
2020-10-06 12:21:20 +02:00
```