Erlang – list_to_atom

Erlang list_to_atom

In this guide, we will discuss Erlang list_to_atom. This method is used to convert a list item to an atom.

Syntax

list_to_atom(listvalue)

Parameters

  • listvalue − This is the list value which needs to be converted to an atom.

Return Value

An atom based on the input of the list value.

For example

-module(helloworld). 
-export([start/0]). 

start() -> 
   io:fwrite("~p~n",[list_to_atom("atom1")]).

Output

The output of the above program is as follows.

atom1

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply