The true, false, and nil Objects

Let's learn about true, false, and nil objects.

There are a few more objects to mention that we’ll see quite frequently. First are true and false.

The true and false objects

The true and false objects are rather straightforward: the true object represents truth, while false represents the opposite.

In other words, true and false are also things, just like the examples of numbers and strings we saw earlier. We can assign them to variables, pass them around, and use them in other ways. They’re fairly simple but useful.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy