Actions
Feature #9587
closedInteger#times with optional starting value
Feature #9587:
Integer#times with optional starting value
Status:
Closed
Assignee:
-
Target version:
-
Description
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.
should give
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.
Actions