In this guide, we will discuss Erlang List_to_binary. This method is used to convert an existing list to a list of binaries.
Syntax
list_to_binary(lst)
Parameters
- Lst − This is the list of values that need to be converted to binary.
Return Value
Returns the bitstring for the list.
For example
-module(helloworld). -export([start/0]). start() -> io:fwrite("~p~n",[list_to_binary([1,2,3])]).
Output
When we run the above program we will get the following result.
<<1,2,3>>
Next Topic : Click Here
Pingback: Erlang - Binaries | Adglob Infosystem Pvt Ltd