aboutsummaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2023-06-01 13:33:59 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2023-06-01 21:44:53 +0900
commita5e1d549b508806b2fd14100683f504c7825a138 (patch)
treee22dae425bd64ea03cb668143bc62029cf2bb941 /hash.c
parenta16cffe384ab167c22b4ae44c05950732cec2ae6 (diff)
downloadruby-a5e1d549b508806b2fd14100683f504c7825a138.tar.gz
[DOC] Mention the edge case of `any?`/`all?`
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/hash.c b/hash.c
index bb356725b2..0aab4443df 100644
--- a/hash.c
+++ b/hash.c
@@ -4432,6 +4432,9 @@ any_p_i_pattern(VALUE key, VALUE value, VALUE arg)
* Returns +true+ if any element satisfies a given criterion;
* +false+ otherwise.
*
+ * If +self+ has no element, returns +false+ and argument or block
+ * are not used.
+ *
* With no argument and no block,
* returns +true+ if +self+ is non-empty; +false+ if empty.
*
@@ -4450,6 +4453,8 @@ any_p_i_pattern(VALUE key, VALUE value, VALUE arg)
* h = {foo: 0, bar: 1, baz: 2}
* h.any? {|key, value| value < 3 } # => true
* h.any? {|key, value| value > 3 } # => false
+ *
+ * Related: Enumerable#any?
*/
static VALUE