Which of the following will match
[ a, b, a ] = [ 1, 2, 3 ]
# (MatchError) no match of right hand side value: [ 1, 2, 3 ]
[ a, b, a ] = [ 1, 1, 2 ]
# (MatchError) no match of right hand side value: [ 1, 1, 2 ]
[ a, b, a ] = [ 1, 2, 3 ]
# [ 1, 2, 1 ]
If you assume the variable a initially contains the value 2, which of the following will match?
[ a, b, a ] = [ 1, 2, 3 ]
# (MatchError) No match of right hand side value: [ 1, 2, 3 ]
[ a, b, a ] = [ 1, 1, 2 ]
# (MatchError) No match of right hand side value: [ 1, 1, 2 ]
a = 1
# 1
^a = 2
# (MatchError) No match of right hand side value: 2
^a = 1
# 1
^a = 2 - a
# 1
NOTES
list1 = [ 3, 2, 1 ]
# [ 3, 2, 1 ]
list2 = [ 4 | list1 ]
# [ 4, 3, 2, 1]
name = "elixir"
"elixir"
cap_name = String.capitalize name
"Elixir"
name
"elixir"
NOTES
Built-in Types:
Integers