Add to a collection

Janet Abdul-Karim jn_karim at yahoo.com
Mon Feb 3 00:54:49 UTC 2003


I created a subclass to ordered collections.  I am trying to add objects to the new class and then print it to make sure they are in there.  I add one object it prints but when I add another object and print it only prints the first object i added

sample code to add to list.

account: aAccount
 "Add an account to the portfolio"

 self isNil ifTrue:[self add: aAccount]
  ifFalse:[ self addLast: aAccount].

 

code to print list. 

ccounts
 "Returns the accounts for the portfolio"

 self do:[:element|^element number].
 



---------------------------------
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/20030202/22c87d31/attachment.htm


More information about the Squeak-dev mailing list