mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
Added an alternative way to fire up a process in Elixir.
This commit is contained in:
parent
0671147741
commit
d8001da799
@ -384,6 +384,8 @@ end
|
||||
|
||||
# Compile the module and create a process that evaluates `area_loop` in the shell
|
||||
pid = spawn(fn -> Geometry.area_loop() end) #=> #PID<0.40.0>
|
||||
#Alternatively
|
||||
pid = spawn(Geometry, :area_loop, [])
|
||||
|
||||
# Send a message to `pid` that will match a pattern in the receive statement
|
||||
send pid, {:rectangle, 2, 3}
|
||||
|
Loading…
Reference in New Issue
Block a user