Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion lang-guide/chapters/filters/select-get.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,26 @@ head: [[meta, {name: draft}]]
---
# Understanding the difference between `get` and `select`

TODO
`get` extracts the value and returns a single value or array if multiple keys have been specified.
```nu
~> {a: 1, b: 2, c: 3} | get b
2
~> {a: 1, b: 2, c: 3} | get b c
╭───┬───╮
│ 0 │ 2 │
│ 1 │ 3 │
╰───┴───╯
```

`select` returns a record without the other values.
```nu
~> {a: 1, b: 2, c: 3} | select b
╭───┬───╮
│ b │ 2 │
╰───┴───╯
~> {a: 1, b: 2, c: 3} | select b c
╭───┬───╮
│ b │ 2 │
│ c │ 3 │
╰───┴───╯
```