How to program input switch??

I usually program my sketch like this:

define setup code
baudrate
pullup / pulldown resistors
debug ?
define pins
declare pin numbers

setup() - pinModes and maybe pullup resistors , and/or serial communication

loop()
get current states
do logic based on the current states
execute based on the current states

[edit]I've actually made a sketch that works, but did not post it in case you want to try for yourself first. Let me know if you want to see it. I'll gladly post.[/edit]