aboutsummaryrefslogtreecommitdiffstats
path: root/enum.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 /enum.c
parenta16cffe384ab167c22b4ae44c05950732cec2ae6 (diff)
downloadruby-a5e1d549b508806b2fd14100683f504c7825a138.tar.gz
[DOC] Mention the edge case of `any?`/`all?`
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/enum.c b/enum.c
index 490b5e4fc8..6fc2fc9b17 100644
--- a/enum.c
+++ b/enum.c
@@ -1757,6 +1757,9 @@ DEFINE_ENUMFUNCS(all)
*
* Returns whether every element meets a given criterion.
*
+ * If +self+ has no element, returns +true+ and argument or block
+ * are not used.
+ *
* With no argument and no block,
* returns whether every element is truthy:
*
@@ -1818,6 +1821,9 @@ DEFINE_ENUMFUNCS(any)
*
* Returns whether any element meets a given criterion.
*
+ * If +self+ has no element, returns +false+ and argument or block
+ * are not used.
+ *
* With no argument and no block,
* returns whether any element is truthy:
*
@@ -1848,7 +1854,6 @@ DEFINE_ENUMFUNCS(any)
* {foo: 0, bar: 1, baz: 2}.any? {|key, value| value < 1 } # => true
* {foo: 0, bar: 1, baz: 2}.any? {|key, value| value < 0 } # => false
*
- *
* Related: #all?, #none?, #one?.
*/