• prograhammingdev@lemmy.prograhamming.com
    link
    fedilink
    arrow-up
    3
    ·
    10 months ago

    IMO I find it really useful in scenarios where you have a set condition that needs to be met (and can always be met so it’s not endless) and looping through to achieve it. I wrote a simple part calculation for a production company I worked for. Essentially while parts_needed < parts packed, pack qty 'x' of part 1, and qty 'x' of part 2 until all parts were filled to the correct amounts. Though it can be done with either / both I just find it more legible.