While loop Bug Fixed

Added userInput as condition to the functions