This second kind of code is just scaffolding. The goal of all programming is to reduce this accidental, synthetic code so that the natural, essential code is more visible. It has nothing to do with adding commas to an input. It's only there because we happened to use an array to hold the chunks of the original input, and arrays are indexed by numbers. Array index variables are almost always synthetic.
Good languages provide many ways to reduce synthetic code.
Here's an example. Suppose you have two variables, a and b , and you want to switch their values. It has nothing at all to do with what you really want to do, which is switch the values of a and b . It's funny how sometimes it can be so much easier to think about something once you have a name for it. Once I had this inspiration about synthetic code, I suddenly started seeing it everywhere.