How to make a while loop with key presses

This makes a lot of sense but i compare the arrows to input based on ints how would i check which actual key was checked also how did you create that compare with current arrow function?