6. Who'er the users?



Why do I get "Edgar"=>668 when I entered 01234?

my_computer = Computer.new("Edgar", 01234)
your_computer = Computer.new("Michael", 56789)


puts "Users: #{Computer.get_users}"


Here's a hint:

irb(main):001:0> 100
=> 100
irb(main):002:0> 0100
=> 64
irb(main):003:0> 0b100
=> 4
irb(main):004:0> 0x100
=> 256


Oh dear, must read up about that. Have not met it before :open_mouth:


Our culture represents numbers with 10 symbols. That is arbitrary. Computers use two. You were writing a number in octal. Hexadecimal is often used to represent bytes. base64 is sometimes used to store data as printable text much more densely than if using only digits, but still not utilising the full range of a byte which is how much space a character usually takes.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.