* enum.c (enum_find): mention about ifnone argument. [ruby-talk:90003]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2004-01-16 14:07:06 +00:00
Родитель 2cb9e7a2e8
Коммит 8e8c7f04ef
1 изменённых файлов: 9 добавлений и 8 удалений

9
enum.c
Просмотреть файл

@ -92,12 +92,13 @@ find_i(i, memo)
/*
* call-seq:
* enum.detect {| obj | block } => obj or nil
* enum.find {| obj | block } => obj or nil
* enum.detect(ifnone = nil) {| obj | block } => obj or nil
* enum.find(ifnone = nil) {| obj | block } => obj or nil
*
* Passes each entry in <i>enum</i> to <em>block</em>. Returns the
* first for which <em>block</em> is not <code>false</code>. Returns
* <code>nil</code> if no object matches.
* first for which <em>block</em> is not <code>false</code>. If no
* object matches, calls <i>ifnone</i> and returns its result when it
* is specified, or returns <code>nil</code>
*
* (1..10).detect {|i| i % 5 == 0 and i % 7 == 0 } #=> nil
* (1..100).detect {|i| i % 5 == 0 and i % 7 == 0 } #=> 35