Code Editor
Learn
The Zen of Ruby

The One-Line Unless

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!

Report a Bug
If you see a bug or any other issue with this page, please report it here.