Neither. No two ways about it. #keysAndValuesDo:
However,
seq with: seq keys do: aBlock
and
seq withIndexDo: aBlock
do the same thing, so #withIndexDo: makes some sense.
This is not my opinion alone. I'm typing this on a machine
that has Squeak but not Pharo. In Squeak we find
doWithIndex: elementAndIndexBlock
"Use the new version with consistent naming"
^ self withIndexDo: elementAndIndexBlock
"New" means since 1997.
On Wed, 13 Mar 2019 at 04:27, Oleksandr Zaytsev <[email protected]>
wrote:
> Hello,
>
> I am working on a new collection and this question caught my interest.
> Between doWithIndex: or withIndexDo:, which do you find more logical and
> why?
>
> Oleks
>