[ruby-core:93106] [Ruby trunk Feature#15919] Offset parameter for `Integer#times`
From:
anamma06@...
Date:
2019-06-13 12:22:02 UTC
List:
ruby-core #93106
Issue #15919 has been updated by ana06 (Ana Maria Martinez Gomez).
I like the idea. It could also be a Hash and appart from `offset`, we could have `step` as well:
```
5.times(offset: 3, step: 2) {|i| p i}
# >> 3
# >> 5
# >> 7
# >> 9
# >> 11
```
----------------------------------------
Feature #15919: Offset parameter for `Integer#times`
https://bugs.ruby-lang.org/issues/15919#change-78531
* Author: sawa (Tsuyoshi Sawada)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
I request an optional argument on `Integer#times` to set the offset at start, just like `Enumerator#with_index`.
```ruby
5.times(3){|i| p i}
# >> 3
# >> 4
# >> 5
# >> 6
# >> 7
```
I think there are plenty of use cases, especially when the offset is 1.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>