Skip to content

Commit

Permalink
Mention patter-filtering in comprehensions
Browse files Browse the repository at this point in the history
  • Loading branch information
sabiwara committed Aug 22, 2023
1 parent 38a7c77 commit cbc21b9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/elixir/pages/cheatsheets/enum-cheat.cheatmd
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ iex> for item <- cart, item.fruit =~ "e" do
]
```

Pattern-matching in comprehensions acts as a filter as well:

```elixir
iex> for %{count: 1, fruit: fruit} <- cart do
...> fruit
...> end
["banana"]
```

## Mapping
{: .col-2}

Expand Down

0 comments on commit cbc21b9

Please sign in to comment.