parallel, without callbacks • distributed • fault-tolerant ("let it crash") • hot code swap • modern syntax & features • very good documentation • helpful community
ruby • all operators are short-circut • and & or requires Boolean as first argument • and & or can be used in guard clauses • everything except nil and false is true-ish (but can't be used in and, or)
opts \\ []) do format(env.request) # call same module function end defp format(request) do IO.inspect(request) # call other module function end defp oneline_add(a,b), do: a + b end # call `process` function from `Tesla.Adapters.Hackney` module Tesla.Adapters.Hackney.process(env, opts)
do spawn_link(__MODULE__, :loop, [value]) end def loop(value) do receive do :inc -> loop(value + 1) :dec -> loop(value - 1) {:get, pid} -> send(pid, {:value, value}) loop(value) end end end