• Vigge93@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      2 hours ago

      Your point about it not running when there is nothing to iterate over is incorrect. The else-statement runs when the iterator is exhausted; if the iterator empty, it is exhausted immediately and the else-statement is executed.

      • lugal@sopuli.xyz
        link
        fedilink
        arrow-up
        2
        ·
        56 minutes ago

        I think it’s intended as “not only when” because it would make sense to have an “if empty” case but the way it is, it doesn’t make sense