Erlang Language Data Types Binaries and Bitstrings

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

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


Got any Erlang Language Question?