Reputation: 31
I am learning the basics of erlang from a video in youtube. And I am stuck at one of the video tutorial. This is the code:
say_something(_,0) ->
io:format("Done ~n");
say_something(Value, Times) ->
io:format("~s ~n", [Value]),
say_something(Value, Times-1).
start_concurrency(Value1, Value2) ->
spawn(easy, say_something, [Value1, 3]),
spawn(easy, say_something, [Value2, 3]).
The say_something
function is ok:
(ErlangProject@Carl-PC)3> easy:say_something("Hello world", 3).
Hello world
Hello world
Hello world
Done
ok
But, when I run start_concurrency
, I don't know what happens, but I don't get what I am supposed to get, as in here:
(ErlangProject@Carl-PC)4> easy:start_concurrency("Hello world", "Really Really").
easy:start_concurrency("Dynamically", "ee").
easy:start_concurrency("dfd", "dfd").
It doesn't return anything. I can just type on and on. What am I doing wrong? Please help me.
Thank you!
Upvotes: 1
Views: 199