Skip to content

Commit

Permalink
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/iterator.cr
Original file line number Diff line number Diff line change
@@ -1049,8 +1049,10 @@ module Iterator(T)

# Yields each element in this iterator together with its index.
def with_index(offset : Int = 0)
with_index(offset).each do |value, index|
index = offset
each do |value|
yield value, index
index += 1
end
end

0 comments on commit 29fe3de

Please sign in to comment.