More detail (it may help if you look at the initial tutorials which will walk you through the basics required in every sketch and introduce just one concept at a time instead of diving into a more complex program). Also, this sketch as shown takes advantage of some language features that make it more efficient, which has the downside of being slightly less readable for a newcomer. I’m not saying the sketch is wrong, what I saying is this is not how someone knew to the whole thing would write it, the way it is indicates a greater experience level with the language.
Anyway… (basing off your initial post version of the code)
First line - that means any time the word ‘numleds’ appears in the program, the value 12 is substituted.
Next line - ledpins is an array listing the Arduino pin numbers that are being used. Because of the way the code works later, there needs to be at LEAST 12 items listed - matching the previous line.
3rd line - all Arduino Sketches need a setup function. For the purposes of sketches like this, just do it as shown. It’s a more advanced topic to know what the ‘void’ means.
4th line - a FOR loop simply counts, the three parameters inside the () tell it how to count. In this case, variable i is used for a counter. It starts at 1. It keeps counting as lon as i is less than or equal to numleds (12), and after each loop it adds 1 to the value of i. So first time, it is 1, then 2, then 3, up until 12. Then it adds 1 to i and makes it 13, and since 13 is not less than or equal to 12, the loop ends.
Inside the loop are two lines. The first one is pinMode, this is the command to tell the Arduino what you are going to use a specific pin for - input or output. In our case, we want to make the pins for the LEDs outputs. Note the reference to the ledpins defined back at the beginning. This returns the i’th item in the ledpins array - when i is 1, it returns the fiurst value, which is 0, when i is 2, it returns the second va