How to check if user made an input in a loop

So basically I'm trying to make a snake program. Snake would move in one direction with help of loops, and when user press anything snake would change direction. However if I ask user to put an input in the loop snake just wouldn't move until something is pressed.

So simply put what should I do that object would move until user press something?
Topic archived. No new replies allowed.