use of resistors on inputs

Sorry for such a basic question, but I'm new here.
Can anyone tell me the purpose of the resistors on the 4-6 figure circuit on the Getting started with arduino paperback book. The resistor is connected to the push button via gnd and 5v, is it there to drop the current between gnd and 5v when the button is pressed?

I have a similar query on fig 5-6 further on in the book, that circuit is the LDR sensor.

I do understand the basics of electronics, I just can't see why on the 1st circuit you need a resistor. On the second I think that the ldr sensitivity comes into it.

Any clarification for the Doh! brigade gratefully received. Thanks. :cry:

The resistor is used to provide a known voltage to the pin when the button is not pressed. A resistor connected to +5v is called a pull-up, connected to ground its a pull-down

see this tutorial for more : http://www.arduino.cc/en/Tutorial/DigitalPins

Thank you for swift response, pull ups, downs are a new concept. Will read tutorial