for loop doesn't work properly with keypad

Hello,
First of all I only had programming in School and that's been a few years ago now. :smiley:
Anyway I mostly undestand the code other people have written, but i have a hard time doing things on my own, so let's get to the problem:
I tried to fill an array with the input of the keypad:

for ( int v=0; v<4;v++){
int key = keypad.getKey();
if (key != NO_KEY)
{
xyz[v] = key -48;
Serial.println(xyz[v]);
delay(2000);
}
}

the array is [0, 0, 0, 0] before the loop starts. I've put in a Serial.println(v); before the if statement. It shows that the for loop doesn't wait for the if and just keeps on repeating. I don't know how to solve this. Can anyone give me a hint what I'm doing wrong?
Thanks

First do some research on the function(s) you try to use so you understand what they do.
http://playground.arduino.cc/Code/Keypad
The keypad.getKey() function does NOT wait for a key.
The function keypad.waitforkey() DOES wait (obviously) but your program cannot do anything else while waiting.

And what the hell is

    xyz[v] = key -48; 
    Serial.println(laenge[v]);

where did laenge[v] come from??

And post your complete code.
And use code tags.
And read the "Read this before posting a programming question ..." section of this forum.