Terminating Loop on Input
===

I'm trying to find a way to terminate a loop when the user hits 'x'+Enter. I want the loop to just keep running in the background until the user cancels it. 

Something along these lines:

    while gets.chomp != 'x'

    	puts 'looping...'

    	sleep 1

    end

I'm a beginner with programming and have searched far and wide for how to do this so any help would be deeply appreciated. 