Erlang – reverse

Erlang reverse

In this guide, we will discuss Erlang reverse. Reverses a list of elements.

Syntax

reverse(lst)

Parameters

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

Return Value

Returns a Reversed list of elements.

For example

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

start() -> 
   Lst1 = [1,2,3], 
   io:fwrite("~p~n",[reverse(Lst1)]).

Output

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

[3,2,1]

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply