Boolean FALSE is zero, anything else is TRUE, so you can use any value that resolves to one or the other in a boolean test. The answers from your examples depend more on how the switch is wired than the program statements used. For instance, a floating switch input is not guaranteed to be in one state or another for any length of time if the switch is open.