Bag.st
changeset 11522 6cda81ef426a
parent 11490 cfb0dc5cc606
child 11523 d47e76cf572d
--- a/Bag.st	Sat Feb 07 14:32:08 2009 +0100
+++ b/Bag.st	Sun Feb 08 11:11:15 2009 +0100
@@ -225,11 +225,12 @@
 !Bag methodsFor:'bulk operations'!
 
 sum
-    "sum up all elements - can be done easier, using bags knowledge."
+    "sum up all elements; return 0 for an empty collection.
+     can be done easier, using bags knowledge."
 
     |accu|
 
-    self isEmpty ifTrue:[ 0 ].
+    self isEmpty ifTrue:[ ^ 0 ].
 
     accu := nil.
     self 
@@ -398,5 +399,5 @@
 !Bag class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.37 2009-01-22 20:25:33 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.38 2009-02-08 10:11:15 cg Exp $'
 ! !