Programming question

my problem is that :

there is an led at pin no 2
and a switch at pin 10 which is pulled down by a 10k resistor.

now I want that my led should be on as soon as the program gets started and it should remain on when I press the switch also but it should get off when I release the switch.

Hope U get me.

What have you tried ?
Post your code and describe any problems that you have had.

After going off when the switch is released what should happen ? Should it turn on again and remain on when the switch is pressed again and turn off when it is released ?

Hope U get me.

Yes. So, what is the problem? The state change detection example shows how to determine when a pin changes state. When the state changes, you know what the current state is, so the change to pressed can be ignored, and the change to released can be where you turn the LED pin off.