add illustration samples

This commit is contained in:
Oli Sturm
2022-07-22 15:00:53 +01:00
parent 0a28574514
commit 250d86bafa
5 changed files with 58 additions and 0 deletions
+14
View File
@@ -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.