• @[email protected]
    link
    fedilink
    21 year ago

    Not that I’m aware of but that’s a condition where you’re thinking with an index. What’s the difference you’re looking for?

    • @indepndnt
      link
      11 year ago

      Something like parsing a string that could have command codes in it of varying length. So I guess the difference is, is this a 1-, 2-, or 3-character code?

      I have something like this in a barcode generator and I keep trying to find a way to make it more elegant, but I keep coming back to index and offset as the simplest and most understandable approach.

      • @[email protected]
        link
        fedilink
        11 year ago

        So you could generate lists of 1, 2, and 3 character code items rather than looking at index +1 or something.