Most languages (Ruby included) allow number literals to be written in at least three bases: decimal, octal and hexadecimal. Numbers in decimal base is the usual thing and are wr
For literals, the prefix is 0b. So
0b100 #=> 4
Be aware that the same exists to format strings:
"%b" % 4 #=> "100"
and you can do:
>> easy_to_read_binary = 0b1110_0000_0000_0000
=> 57344
>> easy_to_read_binary.to_s(10)
=> "57344"
From this manual
0b01011
binary integer
use 0b prefix
>> 0b100
=> 4