Using a button to restart a loop

Hello! I am new to Arduino, and I am trying to program an easy countdown timer for a board game. I want this countdown to be immediately restarted every time someone presses a button (getting a new fresh time for every player’s move).
To that end I am using an Octopus Segment LED Brick to display the numbers, and a simple switch button that should interrupt the main loop (the countdown) and set it back again to its first value.

So my question is - how should this re-starting function look like? I read somewhere that I should use return for that, but I don’t know how to write it and only get error messages.

Just one warning before pasting here my project:
Since I am not familiar with Arduino’s syntax I don’t know - and couldn’t find - how to trigger this very display (that runs over I2C) with millis(), so I ended up just writing the numbers to be displayed and separated them with 1sec delays. That’s why it looks so seedy in the countdown section.

A second question regarding this would be: is it possible to jump back to a certain point of the loop and start over from that position? I could use this to eventually change the duration of the game; i.e. restart the loop at 00:59 instead of at 01:30, and so on and so forth.

Here’s my code:

#include <Wire.h> // Enable this line if using Arduino Uno, Mega, etc.
#include "Adafruit_LEDBackpack.h"
#include "Adafruit_GFX.h"
Adafruit_7segment matrix = Adafruit_7segment();

const int buttonPin = 2;     // the number of the button pin
const int ledPin =  13;      // the number of the LED pin

// variables will change:
int buttonState = 0;         // variable for reading the button status
int interrupcion = 0;           // variable for interruption

void setup() {

  pinMode (ledPin, OUTPUT);
  pinMode (buttonPin, INPUT);

  attachInterrupt(interrupcion, funcionRestart, CHANGE);
  
  matrix.begin(0x70);     // starts the LED display's matrix
}



void loop() {

  int pulsador = digitalRead( buttonPin );    // "pulsador" is buttonPin
  while( pulsador == HIGH )
  {
      matrix.writeDigitNum(0, 0);         // 01:30
      matrix.writeDigitNum(1, 1);
      matrix.drawColon(true);
      matrix.writeDigitNum(3, 3);
      matrix.writeDigitNum(4, 0);
      matrix.writeDisplay();
      delay(1000);
      matrix.writeDigitNum(0, 0);         // 01:29
      matrix.writeDigitNum(1, 1);
      matrix.writeDigitNum(3, 2);
      matrix.writeDigitNum(4, 9);
      matrix.writeDisplay();
      delay(1000);
      matrix.writeDigitNum(0, 0);         // 01:28
      matrix.writeDigitNum(1, 1);
      matrix.writeDigitNum(3, 2);
      matrix.writeDigitNum(4, 8);
      matrix.writeDisplay();
      delay(1000);
      matrix.writeDigitNum(0, 0);         // 01:27
      matrix.writeDigitNum(1, 1);
      matrix.writeDigitNum(3, 2);
      matrix.writeDigitNum(4, 7);
      matrix.writeDisplay();
      delay(1000);
      matrix.writeDigitNum(0, 0);         // 01:26
      matrix.writeDigitNum(1, 1);
      matrix.writeDigitNum(3, 2);
      matrix.writeDigitNum(4, 6);
      matrix.writeDisplay();
      delay(1000);
      matrix.writeDigitNum(0, 0);         // 01:25
      matrix.writeDigitNum(1, 1);
      matrix.writeDigitNum(3, 2);
      matrix.writeDigitNum(4, 5);
      matrix.writeDisplay();
      delay(1000);
      matrix.writeDigitNum(0, 0);         // 01:24
      matrix.writeDigitNum(1, 1);
      matrix.writeDigitNum(3, 2);
      matrix.writeDigitNum(4, 4);
      matrix.writeDisplay();
      delay(1000);
      matrix.writeDigitNum(0, 0);         // 01:23
      matrix.writeDigitNum(1, 1);
      matrix.writeDigitNum(3, 2);
      matrix.writeDigitNum(4, 3);
      matrix.writeDisplay();
      delay(1000);
      matrix.writeDigitNum(0, 0);         // 01:22
      matrix.writeDigitNum(1, 1);
      matrix.writeDigitNum(3, 2);
      matrix.writeDigitNum(4, 2);
      matrix.writeDisplay();
      delay(1000);
      matrix.writeDigitNum(0, 0);         // 01:21
      matrix.writeDigitNum(1, 1);
      matrix.writeDigitNum(3, 2);
      matrix.writeDigitNum(4, 1);
      matrix.writeDisplay();
      delay(1000);
      matrix.writeDigitNum(0, 0);         // 01:20
      matrix.writeDigitNum(1, 1);
      matrix.writeDigitNum(3, 2);
      matrix.writeDigitNum(4, 0);
      matrix.writeDisplay();
      delay(1000); 
      matrix.clear();               // in order to try it out, the countdown is only set to 10 sec. There's no final position (00:00) yet.
      matrix.writeDisplay();
      delay(1000);
      pulsador = digitalRead( buttonPin);
  }

 
}


void funcionRestart() {             // lights up the LED any time a change in the button is performed. This function should cause the loop to restart.
  digitalWrite(ledPin, HIGH);
  delay(10000);
  digitalWrite(ledPin, LOW);

}

Thank in advance for any possible help!

Don't use delays, look at what the millis() function does.

Basically read the time (the start time). While the button is not pressed display the countdown (current time - start time).

When the button is pressed loop() will return and then be called again so the whole thing restarts. You can read the start time and then subtract a value from it, that would make the countdown start later in the sequence.

Thank you very much!

Add print statements into your code so that you can see exactly what your program is doing as it runs. Often your sketch will not be doing what you expect and print statements help you to understand what is going on.

For example when use print statements to show when you have entered and left the loop() function. When you read the start time, print it out and so on.

You are diplaying information on your matrix using long hand code ie. you write code to display one specific time. Instead of that write one function that can display any time from 00:00 to 23:59 depending on what parameters it is passed.