Trying to put my Arduino Pro Mini to sleep

I'm trying to put the mini to sleep with a switch. This code is working but it does not go to sleep until after the //spike 1-5 code. I would like to put it to sleep at any time with the switch (even during the //spike code) but I am not sure how to go about it. I am not intending to wake it back up again, just put it to sleep.

Any help would be very much appreciated.

void loop(){
    
         if (digitalRead(interruptPin) == LOW) {
            
            // spike 1
            spikeWithWarble(5, 0.15, 0.35, 0, 0.04, 254, 255, 1, 8, 100, 6);
            noTone(8);
            delay(800);
            
             // spike 2
            spikeWithWarble(5, 0.17, 0.25, 0, 0.03, 254, 255, 1, 8, 100, 4);
            noTone(8);
            delay(800);
            
             // spike 3
            spikeWithWarble(5, 0.16, 0.25, 0, 0.03, 254, 255, 1, 8, 100, 4);
            noTone(8);
            delay(400);
            
             // spike 4
            spikeWithWarble(5, 0.16, 0.30, 0, 0.04, 254, 255, 1, 8, 100, 5);
            noTone(8);
            delay(500);
            
             // spike 5
            spikeWithWarble(5, 0.15, 0.35, 0, 0.04, 254, 255, 1, 8, 100, 6);
            noTone(8);
            delay(400);
        }  
        
        else if (digitalRead(interruptPin) == HIGH) {
            
            sleep_enable();//Enabling sleep mode
            set_sleep_mode(SLEEP_MODE_PWR_DOWN);//Setting the sleep mode
            digitalWrite(LED_BUILTIN,LOW);//turning LED off
            delay(1000); //wait a second to allow the led to be turned off before going to sleep
            sleep_cpu();//activating sleep mode
           
        }
        
	
}

Use an interrupt for button processing and put device to sleep in that interrupt.

alesam:
Use an interrupt for button processing and put device to sleep in that interrupt.

Thank you alesam for taking the time to help. Is there any chance you could help me out with the interrupts? I have been looking at tutorials, but I'm not getting it.

You also have to reenable interrupts before you put it to sleep in the ISR, since interrupts would otherwise be disabled, and hence you couldn't wake it back up....

DrAzzy:
You also have to reenable interrupts before you put it to sleep in the ISR, since interrupts would otherwise be disabled, and hence you couldn't wake it back up....

Thank you DrAzzy for your answer, for this application, I don't need to wake it back up.

Is this the correct set-up?

void setup(){

        digitalWrite(LED_BUILTIN,HIGH);//turning LED on for testing purposes only
        pinMode(interruptPin,INPUT_PULLUP);//Set pin 2 to input using the built-in pullup resistor
        attachInterrupt(digitalPinToInterrupt(0), spike, CHANGE);

/code]