
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
Pingback: Erlang - nthtail | Adglob Infosystem Pvt Ltd
Pingback: Erlang - Lists | Adglob Infosystem Pvt Ltd