Multiple position switch (either rotary, toggle, etc.)

Thanks for your answer. I've seen in this page http://simvim.com/arduino/in_analog.html that the guy also uses a capacitor. I was wondering why some diagrams I've seen introduces a capacitor and others don't. Is there any real danger of a peak voltage in a circuit like this?

Thanks.

David.