Jonas Roberto de Goes Filho (sysdebug) wrote:
> Gaspard Bucher wrote:
>> A byte is coded on 8 bits, so the maximum is 255 hence the strange
>> results below :
>>
>> irb> 8 * 8 * 7 + 8 * 7 + 7
>> => 511
>> irb> "\777".inspect
>> => "\377"
>> irb> "\777"[0]
>> => 255
>> irb> "\377"[0]
>> => 255
>>
>> \777 is invalid and is truncated to \377.
>>
>>
>>   
> How I represent a number eight?
> 
> sysdebug(main):024:0> "\008"[0]
> => 0
> 
> This returned 0!
8 doesn't exist in octal, so it interprets the 8 as a separate character.

irb(main):009:0> "\007".length
=> 1
irb(main):010:0> "\008".length
=> 2

-- 
Alex