Erlang’s variables are “single assignment”, that is, they cannot be assigned again during the lifetime without being assigned.
Syntax: The first letter must be capitalized (the lowercase begins with an atom) or the underscore begins with the second letter capitalized, such as:
Name
Z
_SomeThing
_Xy
Declaration and assignment:
8> {A, B, C} = {1970, "Richard", male}. {1970, "Richard", male} 9> A. 1970 10> B. "Richard" 11> C. Male 12>
12> {point, X, Y} = {point, 1, 2}. {point,1,2} 13> X. 1 14> Y. 2 15>
Note the following situation: the same variable can appear multiple times in the same pattern, but the two values must be equal:
18> {point, X, X} = {point, 2, 2}. {point,2,2} 19> X. 2 20>