English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Erlang Distributed Programming spawn Method

Distributed Programming in Erlang

This is used to create a new process and initialize it.

Syntax

spawn(Function)

Parameter

  • Function −Function to be generated.

Return Value

This method returns a process ID.

-module(helloworld). 
-export([start/0]). 
start() ->
   spawn(fun() -> server("Hello") end). 
server(Message) ->
   io:fwrite("~p",[Message]).

When we run the above program, we will get the following result.

“Hello”

Distributed Programming in Erlang