[前][次][番号順一覧][スレッド一覧]

ruby-changes:66103

From: Masataka <ko1@a...>
Date: Sat, 8 May 2021 22:41:25 +0900 (JST)
Subject: [ruby-changes:66103] e3e5596782 (master): Fix example code in Array#max doc

https://git.ruby-lang.org/ruby.git/commit/?id=e3e5596782

From e3e55967826668dcf6f04c550cab5ef8df71fdb7 Mon Sep 17 00:00:00 2001
From: Masataka Pocke Kuwabara <kuwabara@p...>
Date: Sat, 8 May 2021 17:04:30 +0900
Subject: Fix example code in Array#max doc

`[0, 1, 2, 3].max(6)` actually returns `[3, 2, 1, 0]`, but the doc said
it returns `[3, 2, 1]`.
---
 array.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/array.c b/array.c
index 50e2418..881270b 100644
--- a/array.c
+++ b/array.c
@@ -5737,7 +5737,7 @@ ary_max_opt_string(VALUE ary, long i, VALUE vmax) https://github.com/ruby/ruby/blob/trunk/array.c#L5737
  *  With an argument \Integer +n+ and no block, returns a new \Array with at most +n+ elements,
  *  in descending order per method <tt><=></tt>:
  *    [0, 1, 2, 3].max(3) # => [3, 2, 1]
- *    [0, 1, 2, 3].max(6) # => [3, 2, 1]
+ *    [0, 1, 2, 3].max(6) # => [3, 2, 1, 0]
  *
  *  When a block is given, the block must return an \Integer.
  *
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]