summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-12 14:32:31 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-12 14:32:31 +0000
commit39b04bc698c8ebebc00ca38ffda01473bfbdc43b (patch)
tree6ba5924decb4d5a3be80c006d8364cac2536690e /enum.c
parent6f866fd9eacd69520918b4e96617a2f43f4d44ec (diff)
[DOC] Add `ifnone` example to `find` documentation [ci skip]
[Fix GH-2110] From: OKURA Masafumi <masafumi.o1988@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/enum.c b/enum.c
index c25b17f..5b1e3c2 100644
--- a/enum.c
+++ b/enum.c
@@ -281,10 +281,12 @@ find_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, memop))
* (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
+ * (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..10).detect(-> {0}) { |i| i % 5 == 0 and i % 7 == 0 } #=> 0
+ * (1..10).find(-> {0}) { |i| i % 5 == 0 and i % 7 == 0 } #=> 0
+ * (1..100).detect { |i| i % 5 == 0 and i % 7 == 0 } #=> 35
+ * (1..100).find { |i| i % 5 == 0 and i % 7 == 0 } #=> 35
*
*/