Skip to content

Commit 1f1e702

Browse files
authored
Update example in working with lists to reflect changes to ++ operator (#1720)
1 parent afdb440 commit 1f1e702

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

book/working_with_lists.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ For example:
4949
let colors = [yellow green]
5050
let colors = ($colors | prepend red)
5151
let colors = ($colors | append purple)
52-
let colors = ($colors ++ "blue")
53-
let colors = ("black" ++ $colors)
54-
$colors
52+
let colors = ($colors ++ ["blue"])
53+
let colors = (["black"] ++ $colors)
54+
$colors
5555
# => [black red yellow green purple blue]
5656
```
5757

@@ -61,7 +61,7 @@ In case you want to remove items from list, there are many ways. [`skip`](/comma
6161
let colors = [red yellow green purple]
6262
let colors = ($colors | skip 1)
6363
let colors = ($colors | drop 2)
64-
$colors
64+
$colors
6565
# => [yellow]
6666
```
6767

@@ -70,7 +70,7 @@ We also have [`last`](/commands/docs/last.md) and [`first`](/commands/docs/first
7070
```nu
7171
let colors = [red yellow green purple black magenta]
7272
let colors = ($colors | last 3)
73-
$colors
73+
$colors
7474
# => [purple black magenta]
7575
```
7676

@@ -79,7 +79,7 @@ And from the beginning of a list,
7979
```nu
8080
let colors = [yellow green purple]
8181
let colors = ($colors | first 2)
82-
$colors
82+
$colors
8383
# => [yellow green]
8484
```
8585

0 commit comments

Comments
 (0)