You can do the exact same thing with the unless statement. The order is the same as before: something for Ruby to do, the unless keyword, and then an expression that evaluates to true or false.

Remember, you don’t need an end when you write a one-line if or unless!



Go ahead and type a one-line unless statement in the editor to the right. It can be whatever you like.

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?