My code doesn't work.

That’s a huge step forward from your first code!
Congratulations in paying attention to the tutorials.

The flow of your code will become more obvious if you press Ctrl+T in the IDE, which will realign and balance up your indenting.

Also, the extra empty/blank lines aren’t necessary unless they emphasise or assist with the readability of the code blocks.

I reckon you’re only a few hours from a working sketch - and you’ve included millis() as well! That will make future functionality much easier to add.

One hint, put your switch ‘upside down’ between the pin and ground, then you can eliminate the external resistor, and use INPUT_PULLUP. Less parts & wiring, but you need to ‘invert’your sensing of the input states.