The outer loop is being drawn for each âframeâ (every 16ms approx if youâre doing 60fps).
This depends on the Begin/Clear/End drawing commands wrapping around the frame to tell it when to start and when to finish for each frame.
If you run an inner loop in that, it will continue to execute inside the current frame and wonât let the frame finish, display itself, and advance to the next one - hence appearing stuck.
Also whilst you are inside a current frame, all of the input has already been read and determined (I would highly assume), you only get to check that when this frame started, whether any of those keys were being pressed. But their state wonât change again until the next frame - something which is being prevented from being reached.
Instead of an inner loop, youâll probably just want to use more conditional logic (ifâs) to determine what to do inside a single frame, given those conditions being met.
Things like user input, delta time, and so on, wonât change inside a frame or main engine loop.