Arduino Void Loop Question

Hey, So im making an LED matrix and multiplexing must be a part of it. I wrote some code that got the rows to switch. But now i want to know how i can sort of name it and late in the code when i want to tell it the same function, i will only have to write down something small instead of that full code. This is because im going to make 2 buttons swap between the different light patterns i make. I may ask for help when i get to that part as well. Thank you, here is my code

PS> im very new to coding

LED_matrix_code.ino (2.34 KB)

The function you're looking for is as below: (make sure its pasted outside of the setup{} and loop{}).

void lightFunction1(void){
 digitalWrite(RowOne,HIGH);
 delay(2);
 digitalWrite(RowOne,LOW);
 digitalWrite(RowTwo,HIGH);
 delay(2);
 digitalWrite(RowTwo,LOW);
 digitalWrite(RowThree,HIGH);
 delay(2);
 digitalWrite(RowThree,LOW);
 digitalWrite(RowFour,HIGH);
 delay(2);
 digitalWrite(RowFour,LOW);
 digitalWrite(RowFive,HIGH);
 delay(2);
 digitalWrite(RowFive,LOW);
 digitalWrite(RowSix,HIGH);
 delay(2);
 digitalWrite(RowSix,LOW);
 digitalWrite(RowSeven,HIGH);
 delay(2);
 digitalWrite(RowSeven,LOW);
 digitalWrite(RowEight,HIGH);
 delay(2);
 digitalWrite(RowEight,LOW);
 digitalWrite(RowNine,HIGH);
 delay(2);
 digitalWrite(RowNine,LOW);
 digitalWrite(RowTen,HIGH);
 delay(2);
 digitalWrite(RowTen,LOW);
 digitalWrite(RowEleven,HIGH);
 delay(2);
 digitalWrite(RowEleven,LOW);
 digitalWrite(RowTwelve,HIGH);
 delay(2);
 digitalWrite(RowTwelve,LOW);
}

When you want to call that function paste this in your loop{}:

lightFunction1();

The first void tells the function that it doesn't have to return with anything after completing the function, the second void after the made up name lightFunction1 (Could be anything you want as long as it matches the name in the loop.) means that you're not trying to bring any variables into the function to do work on.

Thanks a million!