Problems with Collection again.
Janet Abdul-Karim
jn_karim at yahoo.com
Tue Feb 4 01:15:34 UTC 2003
I made an instance of collection and trying to print out what is in the collection. The way I coded seems to only print out the last obect that I added.
code
portfolio: aAccount
portfolio:= SortedCollection new.
portfolio sortBlock:[:x :y | x name < y name].
portfolio add: aAccount.
code to print portfolio
portfolio isNil ifTrue:[Transcript show: 'Portfolio empty'].
ifFalse:[portfolio do:[:element | Transcript show: element name]].
***if you are wondering y i did not use isEmpty instead I tried and it was giving me errors turned out isNil worked just fine. That fact that I could not use isEmpty make me wonder is porfolio is really a collection.***
---------------------------------
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20030203/fcba0ea0/attachment.htm
More information about the Squeak-dev
mailing list
|