4. Setting Up the 'If' Branch, Part 1!


#1

print user_imput = gets.chomp.downcase!
if user_imput.include? "s"
print "there is a s"
end

does this code work for you guys? it does not work for me


#2

I have exactly the same problem. Did you find a solution?


#3

Here, this worked for me

print "Please type here your statement"
user_input = gets.chomp
user_input.downcase!
if
user_input.include? "s"
else
puts "\(^O^)/"
end

-MZ


#5

print user_imput = gets.chomp.downcase!

Your code was almost right except for the typo and "input" and the method chaining. If you put user_input.downcase! on its own line you should pass. (I made the same mistake)


#6

I'm so confused about this :tired_face:


#7

do you take out the .include or do you not?????


#8

when I tried to used what MZ used I got a error message


#9

It should work if you remove the !, i.e. user_input=gets.chomp.downcase.

If I understand correctly (which I very well may not), since ! prevents the creation of a new copy of what is returned by gets.chomp, user_input will end up being nil. By removing the !, you let .downcase return a lowercase copy of what what returned by gets.chop, which is then set to user_input.


#10

Hey thanks man....it helped me pass to the next stage!


#11

That was it for me, too. Thanks!


#12

Nice ,Thanks,it helped me pass to the next stage!


#13

Thanks for this guys !