Skip to content

Latest commit

 

History

History
29 lines (23 loc) · 871 Bytes

takeWhile.md

File metadata and controls

29 lines (23 loc) · 871 Bytes
id mainCompare lesson seeAlso seeAlsoLink title compare learnBackAbout learnAbout video layout class preview_image preview_image_alt
takeWhile
take
17
skipWhile vs takeWhile
skipWhile
take vs takeWhile in RxJS
take
takeWhile
take
skipWhile
250094761
default
post
takeWhile/content_preview.jpg

Exercise

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:

  • On the one hand, ❚ take returns a stream that emits at most amount values and can complete as soon as this amount is reached.
  • On the other hand, ❚ takeWhile has to wait for the predicate to return ✘ false in order to complete.

See also

{:.w300}
Can you fill in the blanks?