From: 7stud -- Date: 2008-05-14T03:49:15+09:00 Subject: Re: How to convert character to hexadecimal? Sebastian Hungerecker wrote: > 7stud -- wrote: >> You can only interpret the meaning of an Integer in reference to some >> base. The return value of the hex method returns an Integer whose base >> is 10. > > How does an Integer whose base is 10 differ from an Integer whose base > is > something else? Or how do you know what base an Integer has? > Is 0xA a decimal number? No? So you'd probably say that 0xA is an > Integer in > base 16 and 10 is an Integer in base 10, right? But 0xA and 10 are the > same > object. 0xA.object_id == 10.object_id #=> true. How can that be if the > base > is something inherent to the Integer (answer: it isn't). > > >> An integer whose reference is base 10 is called a "decimal >> number". > > Integers don't have a base. Only string representations of Integers do. How ruby handles Integers has no bearing on whether a number is called a "decimal number" or an "octal number" or a "hex number". -- Posted via http://www.ruby-forum.com/.