这用于创建新进程并对其进行初始化。
spawn(Function)
Function - 需要产生的功能。
此方法返回一个进程ID。
-module(helloLearnfk). -export([start/0]). start() -> spawn(fun() -> server("Hello") end). server(Message) -> io:fwrite("~p",[Message]).
当我们运行上述程序时,我们将得到以下输出。
“Hello”
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)