Erlang Pattern Match Error?

1> X = 10.
10
2> Y = 9.
9
3> X - 1 = Y.
* 1: illegal pattern
4> Y = X - 1.
9
5> 10 - 1 = Y.
9

Can you explain to me what the illegal template in request 3> is? Thanks!

+4
source share
1 answer

The variable you are bound to should be on the left side, not the right.

This is the correct expression:

Y = X - 1.
+8
source

Source: https://habr.com/ru/post/1606109/


All Articles