I've been trying to tweak one of the examples to work a bit better

I’ve been trying to tweak one of the examples to work a bit better for a xy matrix and i cant exactly figure out the point of a few pieces of this. the code is from the color waves with palettes example (https://gist.github.com/kriegsman/8281905786e8b2632aeb)
in the colorwaves function, why would something be declared with a value, then immediately after its changed to something else, as far as i can tell, before its used for anything else. Am I missing something or reading this wrong? i am rather new to this. This is one of the parts in question (lines 121, 122)
uint16_t pixelnumber = i;
pixelnumber = (numleds-1) - pixelnumber;

The author might have been experimenting with how different things changed the look and there might have been more code at one point that required something slightly different.
Initially to me it seems like those two lines could be combined:
uint16_t pixelnumber = (numleds-1) - i;
But I would have to actually try the code to confirm.

And the compiler will do exactly that behind the scenes - however with it having been done this way, you just need to comment out the “pixelnumber = (numleds - 1) - pixelnumber;” line to reverse the placement on a string/line of leds.

Sometimes folks will be overly verbose in code like this - either to allow for simple changes like that, or to just be explicit about what’s going on, or sometimes just because this is how code evolves over time.

thanks for the answer and insight. think you may have helped me with my current problem as well whoo hooo