[erlang-questions] Newbie help please with variable unsafe in 'receive' & variable unused

Donald Steven <>
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) ->


         {Orbiter1, Coordinates} -> X = element(1, element(1, 
Coordinates)), Y = element(2, element(1, Coordinates)),
                                    Z = element(3, element(1, Coordinates))

         io:format("Coordinates: ~p~n", [Coordinates]),
         io:format("X: ~p, Y: ~p, Z: ~p~n", [X, Y, Z])



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 
init terminating in do_boot ()


Thanks for your help.


More information about the erlang-questions mailing list