我正在从youtube上的视频中学习 erlang 的基础知识。我被困在其中一个视频教程中。这是代码:
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]).
say_something
功能没问题:
(ErlangProject@Carl-PC)3> easy:say_something("Hello world", 3).
Hello world
Hello world
Hello world
Done
ok
但是,当我跑步时start_concurrency
,我不知道会发生什么,但我没有得到我应该得到的东西,如下所示:
(ErlangProject@Carl-PC)4> easy:start_concurrency("Hello world", "Really Really").
easy:start_concurrency("Dynamically", "ee").
easy:start_concurrency("dfd", "dfd").
它不返回任何东西。我可以不停地打字。我究竟做错了什么?请帮我。
谢谢!