For loop into a function

This is the Arduino forum, not the Tinkercad forum