For loop into a function

int buttonPin = 2; // the number of the pushbutton pin
int buttonPin2 = 8;
int ledPin = 13; // the number of the LED pin

int buttonState = 1; // variable for reading the pushbutton status
int buttonState2 = 3;

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT_PULLUP);
  pinMode(buttonPin2, INPUT_PULLUP);
}
void loop() {
  int buttonState = digitalRead(buttonPin);
  if (buttonState == LOW) {
    // blink LED 3 times
  }

  buttonState = digitalRead(buttonPin2);
  if (buttonState == LOW) {
    // blink LED 5 times
  }
}

/* Turning For loop into a function with a  variable of  3 or 5*/

I have it like this now, both buttons not working I use Tinkercad as a simulation