diff options
| author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-08-21 15:18:57 +0000 |
|---|---|---|
| committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-08-21 15:18:57 +0000 |
| commit | 640a02729597a4e0f668b644da69ffe764b80aab (patch) | |
| tree | 795808101ac5ddd38e3d94a8a1d99c3f37803b88 | |
| parent | 015e1a39e39e89badde0b6745dae48c3ebf27548 (diff) | |
| download | ruby-640a02729597a4e0f668b644da69ffe764b80aab.tar.gz ruby-640a02729597a4e0f668b644da69ffe764b80aab.tar.xz ruby-640a02729597a4e0f668b644da69ffe764b80aab.zip | |
rdoc update.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | enumerator.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/enumerator.c b/enumerator.c index ce4a4ee3d..2f9a5589e 100644 --- a/enumerator.c +++ b/enumerator.c @@ -30,13 +30,14 @@ * The enumerator has with_index. * So ary.map.with_index works as follows. * - * p [1,2,3].map.with_index {|o, i| o+i } #=> [1, 3, 5] + * p %w[foo bar baz].map.with_index {|w,i| "#{i}:#{w}" } + * #=> ["0:foo", "1:bar", "2:baz"] * * An enumerator object can be used as an external iterator. * I.e. Enumerator#next returns the next value of the iterator. * Enumerator#next raises StopIteration at end. * - * e = [1,2,3].each # enumerator object. + * e = [1,2,3].each # returns an enumerator object. * p e.next #=> 1 * p e.next #=> 2 * p e.next #=> 3 |
