Tutorial by Examples

file:write_file("myfile.txt", ["Hi " [<<"there">>], $\n]).
["Guten Tag " | [<<"Hello">>]]. [<<"Guten Tag ">> | [<<"Hello">>]]. [$G, $u, $t, $e, $n , $T, $a, $g | [<<"Hello">>]]. [71,117,116,101,110,84,97,103,<<"Hello">>].
Data_1 = [<<"Hello">>]. Data_2 = [Data_1,<<" Guten Tag ">>].
["Guten tag " | <<"Hello">>]. In the shell this will be printed as ["Guten tag "|<<"Hello">>] instead of ["Guten tag ",<<"Hello">>]. The pipe operator will create an improper list if the last element o...
Data = ["Guten tag ",<<"Hello">>], Len = iolist_size(Data), [<<Len:32>> | Data]. The size of an iolist can be calculated using the iolist_size/1. This snippet calculates the size of a message and creates and appends it to the front as a four byte bina...
<<"Guten tag, Hello">> = iolist_to_binary(["Guten tag, ",<<"Hello">>]). An IO list can be converted to a binary using the iolist_to_binary/1 function. If the data is going to be stored for a long period or sent as a message to other processes ...

Page 1 of 1