Numbers in Smalltalk

Tim Rowledge tim at sumeru.stanford.edu
Sun Dec 9 22:05:29 UTC 2001


"James Stark" <james_stark03 at hotmail.com> is widely believed to have written:

> Hi!
> 
> I have a number in a variable number called:
> 
> (anumber)
> 
> I want to output this to a file... but smalltalk comes up with something 
> about "ERROR: anString) when I put nextPutAll.  It does it with strings ok, 
> but with numbers it will not output to a file, any suggestions? is a number 
> a byte?
No, a number is a number. The amount of memory it may use is not
something you need to care about.

try something more like
	fileStream nextPutAll: aNumber printString.
to write the string of the number to a file (or indeed any Stream). 

> Any suggestions would be welcome since I am finding it hard to program in 
> Smalltalk since it seems to take the pinciple of oo to the extreme!
Do please save yourself much time and frustration by looking up some of
the fine tutorials available on the web (start at squeak.org and look
for pointers there and on the swiki) and in print. I'm sure there will
be many suggestions offered on the list, very soon!

tim

-- 
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
If at first you don't succeed, you must be a programmer.





More information about the Squeak-dev mailing list