Skip to Content
Learn
Control Flow in Ruby
Unless

Good! Now let’s review the unless statement.

problem = false print "Good to go!" unless problem

Remember, this is basically a short hand if statement. It will do whatever you ask unless the condition is true. In our example, problem is false, so we don’t have a problem. We print Good to go!

Instructions

1.

Create an unless statement in the editor. The statement should print something to the console.

Folder Icon

Take this course for free

Already have an account?