FAQ: Control Flow in Ruby - Combining Boolean Operators

This community-built FAQ covers the “Combining Boolean Operators” exercise from the lesson “Control Flow in Ruby”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn Ruby

FAQs on the exercise Combining Boolean Operators

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

Hello there, it seems to me the following expression evaluates to false and not true :

boolean_1 = (3 < 4 || false) && (false || true)

Can you please confirm the solution ?


boolean_1 = (3 < 4 || false) && (false || true)

Let’s break it down by working within the parentheses. 3 < 4 is true and false is false. We have an or operator here.

In a previous lesson about or:

Ruby’s || is called an inclusive or because it evaluates to true when one or the other or both expressions are true.

So (3 < 4 || false) evaluates to true.

Now, we have (false || true). false is false and true is true. Are one of these expressions true? Yes, so (false || true) must be true.

true && true evaluates to true.

Hello! Happy Friday afternoon to all.

Something odd happened with this exercise. In the coding space, I answered the three Booleans as

  1. = true
  2. = false
  3. = true

When I clicked RUN, I got the error message “Oops! Something went wrong somewhere…” Double checked, ran it again, same error message.

Went to ‘View Solution’, assuming I’d missed a symbol somewhere, but the solution is the same. ??? No idea what the error was for. I chose ‘Replace with Solution’, whereupon it ran with no error.

Any idea why it gave me an error? Are spaces significant? I might have added a space without noticing.


Are you actually making an assignment, or just answering the question? If the latter, then remove =.

Please link to exercise so we can have a gander.

Okay, thanks for taking a look.


boolean_1 = (3 < 4 || false) && (false || true)

boolean_1 = true

boolean_2 = !true && (!true || 100 != 5**2)

boolean_2 = false

boolean_3 = true || !(true || false)

boolean_3 = true

After resetting and redoing the question, it still comes up correct. Cannot reproduce your described issue. At least you know you were/are on the right track.

Okay, great. Some flaky thing on my end, apparently.

Many thanks, again. Sorry…

1 Like