From: Gennady Bystritsky Date: 2008-05-14T04:48:56+09:00 Subject: Re: How to convert character to hexadecimal? > -----Original Message----- > From: Sebastian Hungerecker [mailto:sepp2k@googlemail.com] > Sent: Tuesday, May 13, 2008 11:54 AM > To: ruby-talk ML > Subject: Re: How to convert character to hexadecimal? > > 7stud -- wrote: > > How ruby handles Integers has no bearing on whether a number is > called a > > "decimal number" or an "octal number" or a "hex number". > > Then I ask you again what does have a bearing on that? > x = 0xA > What kind of number is x? x.class.name will clearly show you that x in an instance of Integer. 0xA is just one of the integer literal notations. Others for the same number are 10, 012, 0b1010. Again, They are all "synonyms" for the same number: 0xA.object_id == 10.object_id == 012.object_id == 0b1010.object_id Integer itself does not have a base, only human representation does. Both for literals and when you want a string or verbal representation of the number. So for your x one would say that it holds a number that may be represented as "10" in base 10, "A" in base 16, "12" in base 8, "1010" in base 2, "101" in base 3, "22" in base 4, and so on. It is true no matter what language you use. Gennady. > > -- > Jabber: sepp2k@jabber.org > ICQ: 205544826