A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://reactivex.io/documentation/operators/range.html below:

ReactiveX - Range operator

  1. Operators
  2. Creating
  3. Range
Range create an Observable that emits a particular range of sequential integers

The Range operator emits a range of sequential integers, in order, where you select the start of the range and its length.

See Also Language-Specific Information:

RxGroovy implements this operator as range. It accepts as its parameters the start value of the range and the number of items in the range. If you set that number of items to zero, the resulting Observable will emit no values (if you set it to a negative number, range will cause an exception).

range does not by default operate on any particular Scheduler, but there is a variant that allows you to set the Scheduler by passing one in as a parameter.

Sample Code
// myObservable emits the integers 5, 6, and 7 before completing:
def myObservable = Observable.range(5, 3);

RxJava implements this operator as range. It accepts as its parameters the start value of the range and the number of items in the range. If you set that number of items to zero, the resulting Observable will emit no values (if you set it to a negative number, range will cause an exception).

range does not by default operate on any particular Scheduler, but there is a variant that allows you to set the Scheduler by passing one in as a parameter.

RxJS implements this operator as range. It accepts as its parameters the start value of the range and the number of items in the range.

range operates by default on the currentThread Scheduler, but there is a variant that allows you to set the Scheduler by passing one in as the optional third parameter.

Sample Code
var source = Rx.Observable.range(0, 3);

var subscription = source.subscribe(
    function (x) { console.log('Next: ' + x); },
    function (err) { console.log('Error: ' + err); },
    function () { console.log('Completed'); });
Next: 0
Next: 1
Next: 2
Completed

range is found in each of the following distributions:

RxPHP implements this operator as range.

Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.

Sample Code
//from https://github.com/ReactiveX/RxPHP/blob/master/demo/range/range.php

$observable = \Rx\Observable::range(0, 3);

$observable->subscribe($stdoutObserver);

   
Next value: 0
Next value: 1
Next value: 2
Complete!
    

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4