From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: poffice@blade.nagaokaut.ac.jp Delivered-To: poffice@blade.nagaokaut.ac.jp Received: from kankan.nagaokaut.ac.jp (kankan.nagaokaut.ac.jp [133.44.2.24]) by blade.nagaokaut.ac.jp (Postfix) with ESMTP id 6C40717D5F7E for ; Mon, 3 Mar 2014 04:58:47 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (smtp.nagaokaut.ac.jp [133.44.2.201]) by kankan.nagaokaut.ac.jp (Postfix) with ESMTP id C2270B5D819 for ; Mon, 3 Mar 2014 04:52:57 +0900 (JST) Received: from funfun.nagaokaut.ac.jp (localhost.nagaokaut.ac.jp [127.0.0.1]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 3C1DD97A83A for ; Mon, 3 Mar 2014 04:52:58 +0900 (JST) X-Virus-Scanned: amavisd-new at nagaokaut.ac.jp Authentication-Results: funfun.nagaokaut.ac.jp (amavisd-new); dkim=fail (1024-bit key) reason="fail (message has been altered)" header.d=sendgrid.me Received: from funfun.nagaokaut.ac.jp ([127.0.0.1]) by funfun.nagaokaut.ac.jp (funfun.nagaokaut.ac.jp [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qk4zmKZYoUgT for ; Mon, 3 Mar 2014 04:52:58 +0900 (JST) Received: from voscc.nagaokaut.ac.jp (voscc.nagaokaut.ac.jp [133.44.1.100]) by funfun.nagaokaut.ac.jp (Postfix) with ESMTP id 0003B97A839 for ; Mon, 3 Mar 2014 04:52:57 +0900 (JST) Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by voscc.nagaokaut.ac.jp (Postfix) with ESMTP id C6D4A95241A for ; Mon, 3 Mar 2014 04:52:53 +0900 (JST) Received: from [221.186.184.76] (unknown [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id C8AF612056E; Mon, 3 Mar 2014 04:52:43 +0900 (JST) X-Original-To: ruby-core@ruby-lang.org Delivered-To: ruby-core@ruby-lang.org Received: from o10.shared.sendgrid.net (o10.shared.sendgrid.net [173.193.132.135]) by neon.ruby-lang.org (Postfix) with SMTP id 81D431204DF for ; Mon, 3 Mar 2014 04:52:40 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.me; h=from:to:references:subject:mime-version:content-type:content-transfer-encoding:list-id; s=smtpapi; bh=hZK/0mlSUflsvGfF7CVFR1Wwrmg=; b=dEpNNvls/7rBp2RfEr x9G8jzDTU5I+45VzGGAZ34bnG96u9oTBB6X2cTmJ2egXC79qL01dYMFXh0lMhzkN LaZ65L2CVLlIwd8xCR3F0ebfZCE0Mte8wQVbXJ8umF26xc7i7nKsjlozJUt7Usqq xCt++Xja29e6Uqxfdzeb8AWTU= Received: by mf158.sendgrid.net with SMTP id mf158.39144.53138C076 Sun, 02 Mar 2014 19:52:39 +0000 (UTC) Received: from herokuapp.com (ec2-54-196-42-39.compute-1.amazonaws.com [54.196.42.39]) by ismtpd-023 (SG) with ESMTP id 144845afce3.531d.5dcedf for ; Sun, 02 Mar 2014 19:52:39 +0000 (GMT) Date: Sun, 02 Mar 2014 19:52:39 +0000 From: sawadatsuyoshi@gmail.com To: ruby-core@ruby-lang.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Redmine-MailingListIntegration-Message-Ids: 35057 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 9587 X-Redmine-Issue-Author: sawa X-Redmine-Sender: sawa X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: OOF Auto-Submitted: auto-generated X-SG-EID: ync6xU2WACa70kv/Ymy4QrNMhiuLXJG8OTL2vJD1yS6r1ouYb1RoUipZ6cAk044YP7QQttqtacCXVb34fGyd+cE2TDOVNHaKAUj0c8XL8SlCnk2EF+0We9uytbL5PkiQG2mtw0W4+tPh+yUX8fwcvP1biAOy4hI8W9dIWyNIJKc= X-ML-Name: ruby-core X-Mail-Count: 61233 Subject: [ruby-core:61233] [ruby-trunk - Feature #9587] [Open] Integer#times with optional starting value X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: ruby-core-bounces@ruby-lang.org Sender: "ruby-core" Issue #9587 has been reported by Tsuyoshi Sawada. ---------------------------------------- Feature #9587: Integer#times with optional starting value https://bugs.ruby-lang.org/issues/9587 * Author: Tsuyoshi Sawada * Status: Open * Priority: Normal * Assignee: * Category: * Target version: ---------------------------------------- Just like `Enumerator#with_index` takes an optional argument that specifies the initial value of the index, I would like to request that `Integer#times` take an optional argument that specifies the initial value. The usefulness of it is similar to that of `with_index` taking an argument. We sometimes want to repeat tasks a given number of times, and want to use an index not necessarily starting from `0`. 6.times(1){|i| puts "Chapter #{i}"} should give Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 with the return value `6`. We can do it with `1.upto(6)`, or with `#{i + 1}` within the block, but giving the initial value to `times` is much easier. -- http://bugs.ruby-lang.org/