Log in from a computer to take this course

You'll need to log in from a computer to start Learn Ruby. But you can practice or keep up your coding streak with the Codecademy Go app. Download the app to get started.

apple storegoogle store

All right! Time to add in a little control flow.

For the if half of our branch, we want to check whether the user’s input contains an "s".

if string_to_check.include? "substring"

We can do that using Ruby’s .include? method, which evaluates to true if it finds what it’s looking for and false otherwise.

(As a general rule, Ruby methods that end with ? evaluate to the boolean values true or false.)



We want to check user_input for the substring "s".

Write an if statement in the editor. It should check to see if user_input includes "s".

For now, print a string of your choice to the console if it finds "s".

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?