Range

Instance of

Class

Inherits from

Object

Description

Represents an immutable range that has start end, and step. The default value of step is 1, it can be floating-point number. Range operator .. (e.g. 0..10, -0.1..-0.2..-0.01) is the recommended way of creating the range.

Example

for (let i in 0..10)
    console.write(i, ", ")
console.newLine()

for (let i in 0..10..2)
    console.write(i, ", ")
console.newLine()

for (let i in 0.5..-0.51..-0.25)
    console.write(i, ", ")

Expected output

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 
0, 2, 4, 6, 8, 
0.500000, 0.250000, 0, -0.250000, -0.500000, 

Members

Inherited members

Properties

  • classPrototype