Erlang – sort

Erlang sort

In this guide, we will discuss Erlang sort. Sorts a list of elements.

Syntax

sort(lst)

Parameters

  • Lst − The list of elements which needs to be sorted.

Return Value

Returns a sorted list of elements.

For example

-module(helloworld). 
-import(lists,[sort/1]). 
-export([start/0]). 

start() -> 
   Lst1=[5,6,4], 
   io:fwrite("~p~n",[sort(Lst1)]).

Output

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

[4,5,6]

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply