Erlang - atom_to_binary



This method is used to convert an atom to a binary value.

Syntax

atom_to_binary(atom)

Parameters

  • atom − The atom which needs to be converted to a binary value.

Return Value

A binary value based on the atom value.

For example

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

start() -> 
   io:fwrite("~p~n",[atom_to_binary('Erlang', utf8)]).

Output

The output of the above program will be as follows.

<<"Erlang">>
erlang_atoms.htm
Advertisements