FAQ: Conditionals & Logic - Relational Operators

This community-built FAQ covers the “Relational Operators” exercise from the lesson “Conditionals & Logic”.

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

Learn C++

FAQs on the exercise Relational 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!

1 Like

whenever I have an if statement in the form of:

if (V R X){
foo; //this is placeholder text for whatever code one might want to use.
}

where V & X are variables and R is a relational operator, what do I call what is inside the parenthesis?
What do I call the block/section of code that begins with if and ends with the }? I want to solidify my vocabulary for communication purposes.

The terminology one uses can vary from person to person, and sometimes even from language to language for that person. However, a common name for V R X would be “condition” and a common name for the entire block of code you posted (from if to the closing }) would be a “conditional statement”, “conditional block”, or just “conditional”.

Thank you.
Also, do you know if a switch statement is a conditional block?

Sorry for the late reply, I didn’t get a notification for this. In terms of terminology with switch statements, I’m not sure if there’s a clear answer on whether a switch statement is considered a conditional block. They perform very similar functions and execute based on conditional logic, but if, else if, and else statements are the ones that first come to mind when we generally think of conditionals. I personally call it a switch block and that generally gets the point across, but I see no issue if you call a switch statement a conditional block if you also use the word switch at some point when communicating.