Functions on Key Press

I am creating a driving game using the following method to drive the car forward:

if (Key.isDown(Key.UP)) {
speed += 1;

I also want to call a function when the key is pressed athough if I add a function call the function gets repeated as long as the key is pressed and I only require it to run once?

Can anyone help?