Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions base/iterator.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ end
"""
enumerate(iter)

An iterator that yields `(i, x)` where `i` is an index starting at 1, and
`x` is the `i`th value from the given iterator. It's useful when you need
not only the values `x` over which you are iterating, but also the index `i`
of the iterations.
An iterator that yields `(i, x)` where `i` is a counter starting at 1,
and `x` is the `i`th value from the given iterator. It's useful when
you need not only the values `x` over which you are iterating, but
also the number of iterations so far. Note that `i` may not be valid
for indexing `iter`; it's also possible that `x != iter[i]`, if `iter`
has indices that do not start at 1.

```jldoctest
julia> a = ["a", "b", "c"];
Expand Down
2 changes: 1 addition & 1 deletion doc/stdlib/collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ type.

.. Docstring generated from Julia source
An iterator that yields ``(i, x)`` where ``i`` is an index starting at 1, and ``x`` is the ``i``\ th value from the given iterator. It's useful when you need not only the values ``x`` over which you are iterating, but also the index ``i`` of the iterations.
An iterator that yields ``(i, x)`` where ``i`` is a counter starting at 1, and ``x`` is the ``i``\ th value from the given iterator. It's useful when you need not only the values ``x`` over which you are iterating, but also the number of iterations so far. Note that ``i`` may not be valid for indexing ``iter``\ ; it's also possible that ``x != iter[i]``\ , if ``iter`` has indices that do not start at 1.

.. doctest::

Expand Down