debouncing a switch during 'while' loop

mdb024:
I understand the concept of debouncing a switch (take the reading about 10 ms apart and if they are the same, consider that the switch has settled), but cannot integrate this idea in the while function.

The simplest method of debouncing, considering you are already using a delay, is to only use the delay.

eg.

if (reading == HIGH)
 {
 delay (10);  // debounce for 10 mS

 // do other stuff

 }

Who cares what the switch reading is after the debounce time? The fact is that the switch was pressed, right?