Erlang Language Binaries and Bitstrings


Example

A binary is a sequence of unsigned 8-bit bytes.

1> <<1,2,3,255>>.
<<1,2,3,255>>
2> <<256,257,258>>.
<<0,1,2>>
3> <<"hello","world">>.
<<"helloworld">>

A bitstring is a generalized binary whose length in bits isn't necessarily a multiple of 8.

1> <<1:1, 0:2, 1:1>>.
<<9:4>> % 4 bits bitstring