Returns a list which contains N copies of the term Elem.
N − The number of times the element needs to be duplicated in the list.
Elem − The element which needs to be duplicated in the list.
Returns a new list with the Element duplicated N times.
-module(helloworld). -import(lists,[duplicate/2]). -export([start/0]). start() -> Lst1 = duplicate(5,1), io:fwrite("~w~n",[Lst1]).
When we run the above program we will get the following result.