Join stepper motor and button code.

I got it to work now. But is this the proper way to do it?

int dirpin = 2;
int steppin = 3;
int button = 7;
int val = 0;

void setup() {
  pinMode(dirpin, OUTPUT);
  pinMode(steppin, OUTPUT);
  pinMode(button, INPUT);
}

void step(boolean dir,int steps){
  digitalWrite(dirpin,dir);
  delay(50);
  for(int i=0;i<steps;i++){
    digitalWrite(steppin, HIGH);
    delayMicroseconds(500);
    digitalWrite(steppin, LOW);
    delayMicroseconds(500);
  }
}

void loop()
{

  val = digitalRead(button);

  if (val == HIGH)
  {
    int i;

    digitalWrite(dirpin, HIGH);   
    for (i = 0; i<1; i++)
    {
      digitalWrite(steppin, HIGH);
      step(true,1600);
      digitalWrite(steppin, LOW);
      delay(10000);
    } 
  }
}