I'm learning Erlang and I've written a simple module to test "spawn" function:
-module(concurrent).
-export([go/0, loop/0]).
go() ->
Pid2 = spawn(echo, loop, []).
loop() -> 2.
but when I run concurrent:go().
I get this error message:
=ERROR REPORT==== 10-Feb-2023::14:41:34.586000 === Error in process
<0.84.0> with exit value: {undef,[{echo,loop,[],[]}]}
I don't understand what I'm doing wrong.
You try to spawn a process running function loop
from module echo
. But you export function loop
from module named concurrent
and not echo
.