add illustration samples
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
% Message passing in Erlang - the "add" and "mult"
|
||||
% identifiers are "atoms", constant values that are
|
||||
% used to match incoming messages (which are technically
|
||||
% tuples).
|
||||
|
||||
loop() ->
|
||||
receive
|
||||
{add, A, B} ->
|
||||
io:format("adding: ~p~n", [A + B]),
|
||||
loop();
|
||||
{mult, A, B} ->
|
||||
io:format("multiplying: ~p~n", [A * B]),
|
||||
loop()
|
||||
end.
|
||||
Reference in New Issue
Block a user