Movement question

ok im making a pacman type game and i got the key movements down but my question is : how do i make it so that like if u press left, the character keeps moving left until it either hits a wall or the player presses a different key … and by keep going left i mean without u having to hold the left arrow key, just press it once.