Skip to content

Instantly share code, notes, and snippets.

@quamen
Created November 17, 2010 08:48
Show Gist options
  • Save quamen/703159 to your computer and use it in GitHub Desktop.
Save quamen/703159 to your computer and use it in GitHub Desktop.
loop(NextNode) ->
io:format("Spawned with NextNode ~p~n", [NextNode]),
receive
{_From, Message, NumberOfHops} ->
io:format("Message '~p' with NumberOfHops ~p~n", [Message, NumberOfHops]),
sendMessage(Message, NextNode, NumberOfHops - 1),
loop(NextNode);
NewNext when NextNode =:= [] ->
loop(NewNext)
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment