Skip to content
Merged
Changes from all commits
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
2 changes: 2 additions & 0 deletions _overviews/scala3-book/collections-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,9 +280,11 @@ val x :: xs = names

Putting that code in the REPL shows that `x` is assigned to the head of the list, and `xs` is assigned to the tail:

```scala
scala> val x :: xs = names
val x: String = adam
val xs: List[String] = List(brandy, chris, david)
```

Pattern matching like this is useful in many situations, such as writing a `sum` method using recursion:

Expand Down