We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5739844 commit 29fe3deCopy full SHA for 29fe3de
src/iterator.cr
@@ -1049,8 +1049,10 @@ module Iterator(T)
1049
1050
# Yields each element in this iterator together with its index.
1051
def with_index(offset : Int = 0)
1052
- with_index(offset).each do |value, index|
+ index = offset
1053
+ each do |value|
1054
yield value, index
1055
+ index += 1
1056
end
1057
1058
0 commit comments