Range
Class representing a range that has start and end indexes and step size.
All instance attributes are read-only. If all arguments are integers, the range produces integer values; otherwise it produces floating-point values. step defaults to 1.
The first value produced is always start, even if it is already past end. Each following value is produced while it is less than end if end is positive, or greater than end if end is zero or negative; the sign of step is not taken into account (known issue, netxms#3810). For example, range(-5, -1) produces only -5, and a range with zero step and positive end greater than start never ends.
Instance attributes
- start ⇒ Number
-
Range start (inclusive).
- end ⇒ Number
-
Range end (exclusive).
- step ⇒ Number
-
Step size.
Constructors
Range(end)range(end)-
Creates new Range object with range from 0 till
end. Range(start, end)range(start, end)-
Creates new Range object with range from
starttillend. Range(start, end, step)range(start, end, step)-
Creates new Range object with range from
starttillendwith step sizestep.