Search code examples
erlangerlang-shell

My erlang code not printing as expected


**
-module(shubham).

-export([call/0, hi/0, guy/0]).


call() ->   hi().

hi() -> guy();

hi() -> io: fwrite("This is hi \n").

guy() -> io:fwrite("This is A guy\n").**

It should print "This is A guy" and then " This is hi" but only prints guy()


Solution

  • You should use , instead of ; after the fourth line and remove hi() -> like below:

     -module(shubham).
     -export([call/0, hi/0, guy/0]).
     call() -> hi().
     hi() -> guy(),
     io:fwrite("This is hi \n").
     guy() -> io:fwrite("This is A guy\n").