> For the complete documentation index, see [llms.txt](https://www.selinux.tech/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.selinux.tech/scala/function-operation/f/flatten.md).

# flatten

## definition

```scala
def flatten[B]: Traversable[B]
```

## demo

```scala
val donuts1: Seq[String] = Seq("Plain Donut", "Strawberry Donut", "Glazed Donut")

val donuts2: Seq[String] = Seq("Vanilla Donut", "Glazed Donut")

val listDonuts: List[Seq[String]] = List(donuts1, donuts2)

// return a single list of donut using the flatten function
val listDonutsFromFlatten: List[String] = listDonuts.flatten
```
