# Sleeping an ATtiny

I've seen several code examples of sleeping an AVR where they do this:

while (1) {

set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
sleep_cpu();
sleep_disable();
}


Now, my question is, why are they setting the sleep mode in the loop? Can't you just do this once during setup and be done with it? Or would something change the sleep mode during runtime? (Ghost in the machine?)

Note: I know the sleep_cpu() needs to be in the while lopp. I am wondering why or why not the line

set_sleep_mode(SLEEP_MODE_PWR_DOWN);


has to be inside the while loop.