summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorchris@chriszimmerman.net <cjay.zimmerman@gmail.com>2015-10-17 19:37:47 -0400
committerchris@chriszimmerman.net <cjay.zimmerman@gmail.com>2015-10-17 19:37:47 -0400
commit65f951d87c80deff6c447faa4690dcfe1bb4d36a (patch)
tree875e58d3b82d56aad69d41adc3c2673af7f40948
parentd8001da79909734d333de31079ca2f4d884a6b21 (diff)
Added documentation on receive do blocks in Elixir.
-rw-r--r--elixir.html.markdown7
1 files changed, 7 insertions, 0 deletions
diff --git a/elixir.html.markdown b/elixir.html.markdown
index 9fdf37e9..60f0b01c 100644
--- a/elixir.html.markdown
+++ b/elixir.html.markdown
@@ -369,6 +369,13 @@ spawn(f) #=> #PID<0.40.0>
# messages to the process. To do message passing we use the `send` operator.
# For all of this to be useful we need to be able to receive messages. This is
# achieved with the `receive` mechanism:
+
+# The `receive do` block is used to listen for messages and process
+# them when they are received. A `receive do` block will only
+# process one received message. In order to process multiple
+# messages, a function with a `receive do` block must recursively
+# call itself to get into the `receive do` block again.
+
defmodule Geometry do
def area_loop do
receive do