Lesson 6 Control flow in Ruby


#1

Here is my code as per ex 1 but it is not passing asking to see ex 1.Where is the error.

var=print"give me a string"
user_input = gets.chomp
user_input.downcase!
user_input.gsub!(/s/,"th")
else
puts "Nothing to do here!"
end


#2

Hi, first of all, please add spaces between operands and operators. For instance:

var = print "give me a string"

That is the standard programming style and makes it easier to read.

The first thing I see in your program is there is an "else" statement, but it is not coupled with anything. Did you mean to couple the else with an if statement?

if condition
  ...
else
  ...
end

#3

Perhaps you need the "your string is #user input?

else
puts "You need an S or more!"

puts "Your string is: #{user_input}"
end