#QUALITY by exept
class: Collection
comment/format in:
#do:whileTrue:
#do:without:
#doWithBreak:
changed:
#do:inBetweenDo:
#doIfNotNil:
--- a/Collection.st Mon Aug 26 09:57:17 2019 +0200
+++ b/Collection.st Mon Aug 26 10:01:42 2019 +0200
@@ -3151,7 +3151,7 @@
<resource: #obsolete>
self obsoleteMethodWarning:'use #do:separatedBy:'.
- ^ self do:aBlock separatedBy:betweenBlock
+ self do:aBlock separatedBy:betweenBlock
"Modified: / 11.2.2000 / 11:23:15 / cg"
!
@@ -3268,7 +3268,8 @@
do:aBlock whileTrue:whileBlock
"evaluate the argument, aBlock for each element until whileBlock
evaluates to false.
- Answer the last result from evaluating aBlock."
+ Answer the last result from evaluating aBlock,
+ or nil if none returned true."
|result|
@@ -3293,7 +3294,8 @@
!
do:aBlock without:anItem
- "enumerate all elements except those equal to anItem into aBlock."
+ "enumerate all elements except those equal to anItem into aBlock.
+ Return the receiver"
self do:[:el |
anItem ~= el ifTrue:[ aBlock value:el ]
@@ -3312,9 +3314,10 @@
doIfNotNil:aBlock
"if I am a collection, then enumerate myself into aBlock.
if I am nil, then do nothing.
+ Return the receiver.
Otherwise, evaluate aBlock with myself as argument."
- ^ self do:aBlock
+ self do:aBlock
"Created: / 20-03-2018 / 15:37:29 / stefan"
"Modified (comment): / 05-08-2018 / 11:26:46 / Claus Gittinger"
@@ -3386,6 +3389,7 @@
"evaluate the argument, aBlock for each element.
Passes an additional exit object, which can be used to leave
the loop early, by sending it a #value message.
+ Returns nil if exited early, the receiver otherwise.
Notice, that this is different to a return statement in the block,
which returns from the enclosed method, NOT only from the block."