Classes | Math

Interval : Collection : Object

range of integers
Source: Interval.sc

Description

An Interval is a range of integers from a starting value to an ending value by some step value.

Class Methods

Interval.new(start, end, step: 1)

Create a new Interval.

Interval(10, 30, 4);
10 to: 30; // the message to creates an interval with step 1

Inherited class methods

Instance Methods

.start

.start = value

The starting value of the interval.

.end

.end = value

The ending value of the interval.

.step

.step = value

The step value of the interval.

.size

Return the number of items in the interval.

Interval(10, 30, 4).size.postln;

.at(index)

Return the indexed item in the interval.

Interval(10, 30, 4).at(3).postln;

.do(function)

Evaluates function for each item in the interval. The function is passed two arguments, the item and an integer index.

Interval(10, 30, 4).do({ arg item, i; item.postln });

Inherited instance methods

Undocumented instance methods

.add

.clipAt(index)

.put

.wrapAt(index)