Bangosushi
Bangosushi

Reputation: 94

Guard not catching the correct data

Code and Debug Info

So here's my code, I don't understand why my second guard isn't catching the data. As you can see on the debugger the data is the same. Unless I'm blind I cannot see the problem

Upvotes: 2

Views: 42

Answers (1)

Steve Vinoski
Steve Vinoski

Reputation: 20004

Data is bound to the value "hey\n", but the {tcp,S,_} tuple you're receiving has a 3rd element of "HEY\n", which does not equal the value of Data. Change that receive clause to:

{tcp,S,Data2} ->

or some other unbound variable name — anything other than Data — and all will be well.

Upvotes: 4

Related Questions