Why does the LED turn on after the while loop becomes false?

Hi,
How have you got your button wired?
1.Between digital input and gnd.
OR
2. Between digital input and 5V

If 1. Have you got a 10K pullup resistor between the digital input and 5V?
If 2. Have you got a 10K pulldown resistor between the digital input and gnd?

What model Arduino are you using?

Thanks... Tom... :smiley: :+1: :coffee: :australia: