Problem with REALLY simple code!! please help

The thing is that i'm just starting with arduino, I borrow my brother's arduino UNO so i can play with it, but i've been trying to run this code all night and nothing happens:

int led1 = 13;
int led2 = 12;
int led3 = 11;
int button = 9;
int var = digitalRead(button);
void setup() {
  // put your setup code here, to run once:
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(button, INPUT);
}
void pip(int led1, int led2, int led3){
 digitalWrite(led1,HIGH);
  delay(500);
  digitalWrite(led1,LOW);
  digitalWrite(led2,HIGH);
  delay(500);
  digitalWrite(led2,LOW);
  digitalWrite(led3,HIGH);
  delay(500);
  digitalWrite(led3,LOW);
}
void loop() {
  // put your main code here, to run repeatedly:

while(var == LOW){
digitalWrite(led1,HIGH);
}
digitalWrite(led1, LOW);
pip(led1,led2,led3);
}

The idea is I push a button and it goes with the pip function, which is a sequence of lights, but no matter how i change it, it whether goes with the standby light (pin1) or it goes with the pip sequence over and over.

Can anybody tell me what's wrong please!!

Thank You!!

int var = digitalRead(button);

That is done once, not continually. You need to do that read inside loop().

The code is supposed to read from a button, and when it's pressed in goes the "pip" sequence once:

int led1 = 13;
int led2 = 12;
int led3 = 11;
int outpin = 10;
int button = 9;
int fun;
int var = 0;
void setup() {
  // put your setup code here, to run once:

pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(button, INPUT);
pinMode(outpin, OUTPUT);
digitalWrite(outpin, HIGH);
}
int pip(int led1, int led2, int led3){
 digitalWrite(led1,HIGH);
  delay(500);
  digitalWrite(led1,LOW);
  digitalWrite(led2,HIGH);
  delay(500);
  digitalWrite(led2,LOW);
  digitalWrite(led3,HIGH);
  delay(500);
  digitalWrite(led3,LOW);
}
void loop() {
  // put your main code here, to run repeatedly:
var = digitalRead(button);
fun = 0;
if(var == HIGH) {
int function = pip(led1,led2,led3);
}
int function = 0;
}

But it whether goes to pip over and over or nothing at all.

If everything is wrong please just tell me how to do it because im tired of trying over and over the same code and not working

Oh my.

int pip(int led1, int led2, int led3){

You are not returning anything, make this void.
You have made led1-3 global so use them directly.

int function = pip(led1,led2,led3);

This is a function prototype, it is not the way you call the pip function.

How is your switch wired?

How is the button wired? Best way is one side of button to ground the other side of the button to a digital input that is set to pinMode(pin, INPUT_PULLUP). The button will read HIGH when not pressed and LOW when pressed (active low). Without a pull up or pulldown the pin will "float" when unpressed. A floating pin's state is undefined.

How does the pullup work? Sorry i'm really a newbie in all of this and I really want to learn...
Here is the wire made in fritzing, It's actually less messy but you can see every connection.

Any help? still doesn't work!, at least give me the way to write the right code so I can get this over and done :confused:

@gramsch, you should just draw your circuit diagram with a pencil and post a photo of the drawing. It will then be clearer to you and to us than the sort of pseudo photo that you have posted.

For example it looks from your diagram that you are using a LED without a current limiting resistor - which should never happen.

...R

gramsch, are you clear on the connections within a breadboard? Your diagram shows an expected connection across the center.