Erlang - list_to_tuple



This method is to convert a list to a tuple.

Syntax

list_to_tuple(list)

Parameters

  • list − This is the list which needs to be converted to a tuple.

Return Value

Returns a tuple based on the list provided.

For example

-module(helloworld). 
-export([start/0]). 

start() -> 
   io:fwrite("~w",[list_to_tuple([1,2,3])]).

Output

The output of the above program is as follows

{1,2,3}
erlang_tuples.htm
Advertisements