Skip to content

Commit a406527

Browse files
authored
Mention patter-filtering in comprehensions (#12883)
1 parent 38a7c77 commit a406527

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/elixir/pages/cheatsheets/enum-cheat.cheatmd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ iex> for item <- cart, item.fruit =~ "e" do
113113
]
114114
```
115115

116+
Pattern-matching in comprehensions acts as a filter as well:
117+
118+
```elixir
119+
iex> for %{count: 1, fruit: fruit} <- cart do
120+
...> fruit
121+
...> end
122+
["banana"]
123+
```
124+
116125
## Mapping
117126
{: .col-2}
118127

0 commit comments

Comments
 (0)