Closed slepher closed 4 years ago
elixir-lang#case-cond-and-if
If you want to pattern match against an existing variable, you need to use the ^ operator:
iex> x = 1 1 iex> case 10 do ...> ^x -> "Won't match" ...> _ -> "Will match" ...> end "Will match"
elixir-lang#case-cond-and-if
If you want to pattern match against an existing variable, you need to use the ^ operator: