debounce question: introduce delayed action

Robin2:
(...)

The final IF statement (or more particularly its ELSE clause) may not do what you expect because the ELSE will be triggered if either part of the IF is false - which is probably most of the time.

...R

How do I execute the else only once, ie once the LED2 is LOW, no further digitalWrite; and same for LED2 set to HIGH.

Because now this gets executed time and again.

Introduce ledState2 maybe, and get digitalWrite to execute dependent on ledState2?