If switchVal is an input pin connected to a switch, use S3 as the way to wire your switch.
Look for a low for a switch closed, turn on the internal pull-up resistor.
S1 circuit is not recommended as there is the chance of 5v shorting to other components in the project.
If you wire your switches as S3 is wired, you can use the built in pull-up resistors on the input pins. i.e. you do not need to wire external resistors.
When you look for a switch closed condition, look for a LOW.