In the following example, the greet
function inside Greeter
module is run in a separate process:
defmodule Greeter do def greet do IO.puts "Hello programmer!" end end iex> spawn(Greeter, :greet, []) Hello #PID<0.122.0>
Here #PID<0.122.0>
is the process identifier for the spawned process.