[Newbies] In Squeak SmallTalk, what can I do to display a number in any hex I want?

K K Subbu kksubbu.ml at gmail.com
Mon Oct 23 11:16:03 UTC 2017


On Monday 23 October 2017 04:40 PM, RedTigerFish wrote:
> Hello, thanks for your answer.
> 
> Here is my thinking:
> 
> Transcript show: (23124234 * 431213) hex; cr
> 
> The above code only displays a decimal in hexadecimal which is base-16.
> Now I want a decimal number to be displayed in base-17 or 20 or 100 or 250
> or any positive integer.
> How can I do that? Is that possible in Smalltalk?
Yes, with printStringBase: method

    Transcript show: ((23124234 * 431213) printStringBase: 17); cr

HTH .. Subbu


More information about the Beginners mailing list