misoca / reading_programming_elixir

プログラミングElixir読書会のレポジトリ
1 stars 0 forks source link

変数の束縛 #7

Open eitoball opened 5 years ago

eitoball commented 5 years ago

こういう再束縛ができるので、普通の変数みたいに使ってしまう。

iex> a = 1
iex> a = 2
iex> 2 = a
iex> 1 = a
** (MatchError) no match of right hand side value: 2
thara commented 5 years ago
iex(41)> x = 1
1
iex(42)> [^x, x] = [1,2]
[1, 2]