I am new to "electrical engineering" and I am working on a little arduino project. I want to have a SPST switch be used as a digital input on the board. 

I have one of the switch leads connected to posative and the other connected to the digital input. The problem with this is that when the switch it off I can't be sure the input will be grounded. How can I make sure the input is grounded when the switch is off? 

Would it work if I connected the digital input to a resistor that is connected to ground so when the switch is off it will be grounded, but when the switch is on it wont short out -- would that work?