This is the code i am running in an online compiler
-module(helloworld).
-export([start/0, call/2]).
start() ->
% error in the below line as syntax error before: ')'
Pid = spawn(?MODULE, call, ["hello","world"] ),
io:fwrite("~p",[Pid]).
call(Arg1, Arg2) ->
io:format("~p ~p~n", [Arg1, Arg2]).
I tried erlang compiler online in tutorialspoint
and can reproduce problem. I guess it got some problem in compiler, it's not your fault, just continue investigate Erlang
:)
You can change to this compiler online
//Edit:
The issue may become from editer of tutorialspoint
. It makes compiler don't understand function spawn/3
, please add double quoute ''
for spawn/3
function like below, It will compile and run:
Pid = 'spawn'(?MODULE, call, ["hello","world"] ),