Magnitude.st
changeset 11837 27fb4984e97b
parent 11602 b7c26da0a6c3
child 15374 13a5c9dae49b
child 18011 deb0c3355881
equal deleted inserted replaced
11836:0d70352a70bc 11837:27fb4984e97b
   282         ].
   282         ].
   283      ]
   283      ]
   284     "
   284     "
   285 !
   285 !
   286 
   286 
       
   287 to:stop count:aBlock
       
   288     "same as (self to:stop) count:aBlock"
       
   289 
       
   290     |cnt|
       
   291 
       
   292     cnt := 0.
       
   293     self to:stop do:[:i |
       
   294        (aBlock value:i) ifTrue:[ cnt := cnt + 1 ].
       
   295     ].
       
   296     ^ cnt
       
   297 
       
   298     "
       
   299      1 to:10 count:[:n | n even]
       
   300     "
       
   301 !
       
   302 
   287 to:stop do:aBlock
   303 to:stop do:aBlock
   288     "For each element of the interval from the receiver up to the argument stop,
   304     "For each element of the interval from the receiver up to the argument stop,
   289      evaluate aBlock, passing the number as argument."
   305      evaluate aBlock, passing the number as argument."
   290 
   306 
   291     |tmp|
   307     |tmp|
   383 ! !
   399 ! !
   384 
   400 
   385 !Magnitude class methodsFor:'documentation'!
   401 !Magnitude class methodsFor:'documentation'!
   386 
   402 
   387 version
   403 version
   388     ^ '$Header: /cvs/stx/stx/libbasic/Magnitude.st,v 1.24 2009-02-28 00:22:15 cg Exp $'
   404     ^ '$Header: /cvs/stx/stx/libbasic/Magnitude.st,v 1.25 2009-08-10 13:30:08 cg Exp $'
   389 ! !
   405 ! !