function '<-'/2 undefined Error in receive block Elixir

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 09:57:38

问题


This is my Elixir code.

defmodule ErlProcess do
    def receiver do
        receive do
            {:sayHello, msg}->sender<-{:ok, "ok"}
        end
    end
end

But it gives this error.

** (CompileError) spawn.exs:4: function '<-'/2 undefined
    (stdlib) lists.erl:1323: :lists.foreach/2
    (stdlib) erl_eval.erl:569: :erl_eval.do_apply/6
    (elixir) src/elixir.erl:140: :elixir.eval_forms/4
    (elixir) src/elixir_lexical.erl:17: :elixir_lexical.run/2

How to fix this?


回答1:


pid <- msg was removed, please send pid, msg instead.



来源:https://stackoverflow.com/questions/22587524/function-2-undefined-error-in-receive-block-elixir

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!