October 2018
Intermediate to advanced
420 pages
10h 26m
English
The take_while operator emits items from the source observable until a criterion is met. The following figure shows the marble diagram of this operator:

Its prototype is the following:
Observable.take_while(self, predicate)
Here, predicate is a function called each time an item is emitted form the source observable. When the predicate function returns True, then the take_while operator stops emitting items of the source observable.
Here is an example of the take_while operator:
numbers = Observable.from_([1, 2, 3, 4])numbers.take_while(lambda i: i < 2).subscribe( on_next = lambda ...