Setting Up the ‘If’ Branch, Part 1 – Correct Example – Codeacademy

This is a funny one.

The correct example:

print user_imput = “Hello”
user_input = gets.chomp
user_input.downcase!

if user_input.include? “s”
print “Cristi ruleaza”
end

***

Notice that if you don’t add “end” after your last print, Codeacademy will return an error.
You don’t need an actual “else” statement. Just to add “end” so the code will know that your if statement has ended. This is how Ruby works.

codeacademy

ADD A COMMENT: