Don’t touch things unless you have a good reason to do so. And when you have a good reason, touch it exactly as much as you need - but never more.
Don’t touch things unless you have a good reason to do so. And when you have a good reason, touch it exactly as much as you need - but never more.
One benefit of using dropwhile is that (with a bit of practice) it can actually be easier to read than a for loop. All for loops look similar. You need to read the for loop line by line to understand what it really do.
With dropwhile (or map, filter and reduce), it’s immediately obvious it will drop all elements until a certain condition turns false.