aboutsummaryrefslogtreecommitdiffstats
path: root/enum.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-05 23:16:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-05 23:16:28 +0000
commit4525621c597bfaa67c8dc26016eceb9093ef626c (patch)
tree72e579a7245c6bab690c7141db013cacfbebabb1 /enum.c
parentf8eba2af459b371b956cf22df13f00ed1d0f6d8c (diff)
downloadruby-4525621c597bfaa67c8dc26016eceb9093ef626c.tar.gz
enum.c: examples of Enumerable#detect [ci skip]
* enum.c (enum_find): [DOC] add more examples to the documentation of Enumerable#detect, to show that it equals to Enumerable#find. [Fix GH-1340] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54925 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/enum.c b/enum.c
index 9387ec3b6a..7ecf00e56b 100644
--- a/enum.c
+++ b/enum.c
@@ -225,7 +225,12 @@ find_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
*
* If no block is given, an enumerator is returned instead.
*
+ * (1..100).detect => #<Enumerator: 1..100:detect>
+ * (1..100).find => #<Enumerator: 1..100:find>
+ *
* (1..10).detect { |i| i % 5 == 0 and i % 7 == 0 } #=> nil
+ * (1..10).find { |i| i % 5 == 0 and i % 7 == 0 } #=> nil
+ * (1..100).detect { |i| i % 5 == 0 and i % 7 == 0 } #=> 35
* (1..100).find { |i| i % 5 == 0 and i % 7 == 0 } #=> 35
*
*/