elixir-iex

What is the exact meaning of the equal sign in Elixir?

Deadly 提交于 2021-02-05 06:18:46
问题 I don't get what exactly means the equal sign in Elixir. What is unclear is that it looks like a mix between assignment and a pattern matching operation. iex(1)> x=4 4 iex(2)> y=5 5 iex(3)> 3=y ** (MatchError) no match of right hand side value: 5 iex(3)> y=3 3 iex(4)> y=x 4 I understand that in Elixir, the equals operator means to match the left side of the = sign to the the right side. First two lines make sense to me. x and y are unbound variables, hence they could match anything. They are