diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-12 14:32:31 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-12 14:32:31 +0000 |
commit | 39b04bc698c8ebebc00ca38ffda01473bfbdc43b (patch) | |
tree | 6ba5924decb4d5a3be80c006d8364cac2536690e /enum.c | |
parent | 6f866fd9eacd69520918b4e96617a2f43f4d44ec (diff) |
[DOC] Add `ifnone` example to `find` documentation [ci skip]
[Fix GH-2110]
From: OKURA Masafumi <[email protected]>
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.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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 * */ |