[erlang-questions] Newbie help please with variable unsafe in 'receive' & variable unused
Donald Steven
t6sn7gt@REDACTED
Thu Sep 29 16:22:30 CEST 2016
Hi everyone,
Can someone please put me out of my (extended) misery? The part of the
code that's causing the problem is:
=============================
loop(Orbiter1) ->
receive
{Orbiter1, Coordinates} -> X = element(1, element(1,
Coordinates)), Y = element(2, element(1, Coordinates)),
Z = element(3, element(1, Coordinates))
end,
io:format("Coordinates: ~p~n", [Coordinates]),
io:format("X: ~p, Y: ~p, Z: ~p~n", [X, Y, Z])
loop(Orbiter1).
=============================
which produces the error:
base.erl:48: variable 'Coordinates' unsafe in 'receive' (line 35)
base.erl:37: Warning: variable 'X' is unused
base.erl:37: Warning: variable 'Y' is unused
base.erl:38: Warning: variable 'Z' is unused
{"init terminating in
do_boot",{undef,[{base,main,[],[]},{init,start_em,1,[]},{init,do_boot,3,[]}]}}
init terminating in do_boot ()
=============================
Thanks for your help.
Don
More information about the erlang-questions
mailing list