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


#1



HELP PLEASE. What is wrong in my code?

print "input: "
user_input=gets.chomp.downcase!
if user_input.include?"s"
    puts "Found s "
else 
    puts "Don't found s"
end


#2

user_input=gets.chomp.downcase!

remove the ! because it returns nil class if no changes were made.

if you type a string value that already downcase then it'll return nil class.


#3

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