First off you should use the code tags (# button when writing message) around code as it makes it more readable and more likely people will respond.
Your using pin 10 for the sensor that I assume should be input pin but your defining it for output ALSO your trying to read this pin using analogRead but only pins A0-A5 are analogue input pins. You need to set sensor as INPUT and try using digitalRead instead of analogRead OR change code and wiring to use one of the analogue pins.
int sensor = 10;
int var = 0;
var = analogRead(sensor);