Project

General

Profile

Actions

Feature #14697

closed

Introducing Range#% as an alias to Range#step

Added by mrkn (Kenta Murata) over 6 years ago. Updated about 6 years ago.

Status:
Closed
Target version:
[ruby-core:86588]

Description

In #13904, Enumerator::ArithmeticSequence has been accepted for the representation of a range with step value.
And in #12912, a new syntax of endless range (1..) has been accepted.

Combining these new features, we can write an endless step range like (1..).step(2) in Ruby 2.6.
It can be used for array slicing like python's 1::2.

If Range#% is introduced as an alias to Range#step, we can write a step range like (1..)%2.
This notation is already introduced numo-narray.


Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #12912: An endless range `(1..)`ClosedActions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0