Daffy duck lesson 7 help


#1

print "what is your favorite sport"
user_input= gets.chomp.downcase!
if user_input.include? "s"
user_input.gsub!(/s/, "th")
else print "none"
end

my_string = "muchachos"
puts "adios, #(my_string)"

^^^here's my code.

it returns:

what is your favorite sport Baseball
adios, #(my_string)
nil

what am I doing wrong?

thanks in advance.

`


#2

Okay! First, you might need to show the user their transformed string using 'puts' instead of 'print' in the else block. Also, remove the exclamation mark here:


#3

Hi jbeck19
use #{var_name} instead of #(var_name)

puts "adios, #{my_string}"


#4

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