|| within an `if` statement`


I couldn't get this to work:

print "Input:"

if  user_input.include?  "s" || user_input.include?  "S"

I resorted to

print "Input:"
if  user_input.downcase.include?  "s"

But I don't understand what was wrong with my previous version. Ideas?

Here's what Ruby complained about:

(ruby):3: syntax error, unexpected tSTRING_BEG, expecting keyword_then or ';' or '\n'
...user_input.downcase.include?  "s"
...                               ^
(ruby):7: syntax error, unexpected keyword_else, expecting $end


It's just a problem of syntax.

Try this:

if user_input.include?("s") || user_input.include?("S")


Aha, thanks.

I wonder why they didn't teach us this more robust version in the first place.