Thith Meanth War: How do I re-prompt the user if they didn't input anything?


#1



I'm working on Thith Meanth War, and have been able to include all the other letters, but am unsure how to re-prompt a user? Do I just paste the same code into the first if statement?

Currently it just puts "please enter something" and the code ends.


print "How are you Daffy Duck?"
user_input = gets.chomp
user_input.downcase!

if user_input.empty?
    puts "please enter something"
    
elsif user_input.include? "s" || "se" || "ce"
    user_input.gsub!(/s/, "th")
    user_input.gsub!(/se/, "th")
    user_input.gsub!(/ce/, "th")
    puts "hehe #{user_input}!"
else
    puts "Nothing to Daffify!"
end


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.