I do not see any difference between takewhile and filter. Can someone help? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I do not see any difference between takewhile and filter. Can someone help?

I do not see any difference between takewhile and filter. Can someone help?

3rd Jul 2017, 11:06 AM
Rakesh
Rakesh - avatar
2 Answers
+ 3
filter will work for the whole sequence whereas takewhile will work till the condition is true.
3rd Jul 2017, 11:08 AM
Sandesh
Sandesh - avatar