Exception
Exception

Reputation: 8379

Why this pattern is not matched

Hi I am new to Erlang and have tried the below code in Pattern Matching. As expected it does not work for me, Someone please help me to understand this concept better

1> Prat = {name,{{first,prat},{last,redy}},{age,23},occupation,{{company,"TS"},{work, "SW"}}}
2> {_,{_,_},_,_,{{_,c},_}} = Prat

But it returns me unmatched error. Please help me on this.

Upvotes: 3

Views: 147

Answers (1)

Chen Yu
Chen Yu

Reputation: 4077

In this expression, "{_,{_,_},_,_,{{_,c},_}} = Prat", c is a variable, should be capitalized. {_,{_,_},_,_,{{_,C},_}} = Prat.

C = "TS".

Upvotes: 8

Related Questions