• magic_lobster_party@kbin.social
    link
    fedilink
    arrow-up
    0
    ·
    11 months ago

    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.