if pin 1 is high in 3seconds led will turn on else ignore .(if statement .help.)

UKHeliBob:
You know the time that the button was pressed (onTime) copied from millis() when it happened.
Later there is a check whether the current time, millis(), minus onTime is greater than 3000. If it is, then 3000 milliseconds (3 seconds) have passed and something needs to be done. If not then don't hang around waiting, get on with something else and check the elapsed time again next time round the loop()

Does that help ?

the millis records the time between the button is pressed and released? right?

ok, if the value of the millis is passed to "ontime"

why did he minus the millis to the ontime?

it supposed to be ontime>3000

but the code works well. i wonder why.