How exactly doesn't it work? What doesn't it do that you want it to?
Do you want the check for user input to pause the loop, or do you want the loop to continue running while a check for user input is made?