Cédric Soulas
Motion graphics about programming

 

Episode 17 - take(count) vs takeWhile(predicate) Monday, 8 Jan.

In Episode 6, I introduced the ❚ filter card, used with a predicate (a function that returns ✔ true or ✘ false).

In Episode 9, I presented the ❚ take card and the ◉ complete notification (a special kind of event emitted upon stream completion).

In this episode, I compare ❚ take with a new card: ❚ takeWhile. The former accepts a maximum amount, whereas the latter accepts a predicate:

This is how ❚ takeWhile operates:

In the animation above, can you spot the difference between the outputs? Can you explain why?

Answer

The ◉ complete notification happens at a different moment:

Cards to learn Reactive Programming

Focus on one new concept – every Monday

Occasional updates, plus:
Cédric Soulas
Motion graphics about programming