1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[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
This commit is contained in:
nagachika 2019-04-12 14:32:31 +00:00
parent 6f866fd9ea
commit 39b04bc698

10
enum.c
View file

@ -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
*
*/