Matrix Keypad - Optimisation

I can see the point of the while <25 loop - the code just sits in there reading the value every 50mS until it sees a key pressed (value >=25).
Is your program going to do anything else? Or just sit there monitor the keypad its whole existince?
You could do something else instead - see the blink without delay program.
You basically put your code inside a larger loop.
The outer one checks the time passed, say every 100mS, if 100mS hasn't passed you ignore your keypad and do other stuff. When you hit the 100mS mark, you read the keypad, if nothing is pressed go do other stuff again.

The analog pin sits at ~0V when no key is pressed because all the resistors are only connected to ground until a key is pressed?