--- a/Magnitude.st Wed Jun 14 11:45:32 2017 +0200
+++ b/Magnitude.st Wed Jun 14 15:23:48 2017 +0200
@@ -345,6 +345,33 @@
"
!
+to:stop do:aBlock separatedBy:actionBetween
+ "For each element of the interval from the receiver up to the argument stop,
+ evaluate aBlock, passing the number as argument.
+ Between each, evaluate actionBetween (but not before the first and not after the last)"
+
+ |tmp first|
+
+ tmp := self.
+ first := true.
+ [stop < tmp] whileFalse:[
+ first ifFalse:[
+ actionBetween value.
+ ].
+ first := false.
+ aBlock value:tmp.
+ tmp := tmp+1.
+ ]
+
+ "
+ 1 to:10
+ do:[:i | Transcript show:i]
+ separatedBy:[ Transcript show:', '].
+ "
+
+ "Created: / 14-06-2017 / 15:23:21 / cg"
+!
+
to:stop doWithBreak:aBlock
"For each element of the interval from the receiver up to the argument stop,
evaluate aBlock, passing the number as argument.