VIRTUAL COMPUTER - 1. What You'll Be Building, eric => 668


Probably not going to copy the entire line of code but… (here)
In the default provided code, line 22 and 23.

22| my_machine ="eric", 01234)
23| your_machine ="you", 56789)
28| puts "Users: #{Machine.get_users}"


Users: {"eric"=> 668, "you"=>56789}

if I changed it to

22| my_machine ="eric", 11234) #Changed to 11234


Users: {"eric"=>11234, "you"=>56789}

Could someone explain to me why Users Eric != 01234 but 668?

OK, I found out that although 01234 is a fixnum, 01234 base8 == 668 base10

Why is it that 668 is then taken and interpreted as an int rather than as 01234?
Are there any other data conversion of ruby that isn’t (or I missed it) explained? Like 0x1234 (base16) == 4660 (base10)


You can’t start integers with a zero.
It’s common to most languages