[erlang-questions] Need help Simple interconnection problem

Ian Brown spam@REDACTED
Tue Mar 23 23:11:56 CET 2010


Also, use the '%' for comments...not the slash '/' 

>>  //to execute 2.erl


should be 

% to execute...

On Mar 23, 2010, at 1:07 PM, Fred Hebert wrote:

> 2 things:
> 1. module names have to be atoms. Numbers won't do it.
> 2. in 2.erl, the last branch of the receive ('_ -> ...') ends with a ';'.
> This is not required.
> 
> 
> On Tue, Mar 23, 2010 at 3:52 PM, NavaTux <navaneethanit@REDACTED> wrote:
> 
>> I have written a code 1.erl which i wanna to be connected with 2.erl
>> to make the link for print some information
>> 
>> 1.erl
>> 
>> -module(1).
>> -Author("nava").
>> -export([start/0,loop/1]).
>> start() ->
>> 
>>     Pid = spawn(fun()->loop() end),
>>     register(nava,Pid).
>> 
>> 
>> 
>> loop()->
>>       receive
>> 
>>               message->
>>                       io:format("This is ur message Nava:~n",[]),
>>                       2:start();                   //to execute 2.erl
>> 
>>               _->
>>                       io:format("Empty"),
>>                       void
>> 
>>               end.
>> 
>> 
>> 
>> 2.erl
>> 
>> 
>> -module(2).
>> -export([start/0,print/1]).
>> 
>> start()->
>> 
>>       Pid1=spawn(fun() -> print() end).
>> 
>> print()->
>> 
>>     receive
>> 
>>          welcome->
>> 
>>               io:format("Success:~n");
>> 
>>               _->
>> 
>>               io:format("try once again u ll get success~n");
>>       end.
>> 
>> when i used to compile
>> 
>> 
>> (nitrogen@REDACTED)3> sync:go().
>> Recompile: ./src/libs/2
>> ./src/libs/2.erl:1: bad module declaration
>> ./src/libs/2.erl:19: syntax error before: 'end'
>> ./src/libs/2.erl:2: no module definition
>> ./src/libs/2.erl:2: function print/1 undefined
>> ./src/libs/2.erl:6: function print/0 undefined
>> ./src/libs/2.erl:6: Warning: variable 'Pid1' is unused
>> ok
>> 
>> 
>> what does go wrong here?
>> why it happens?/
>> help me plz!!
>> 
>> 
>> 
>> ________________________________________________________________
>> erlang-questions (at) erlang.org mailing list.
>> See http://www.erlang.org/faq.html
>> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>> 
>> 



More information about the erlang-questions mailing list