Bold Aesthetic Creative Games

An Indie Game Studio Developing Bold, Aesthetic & Creative Video Games

C++ Programming Series: Complex Conditions

C++ Programming Series: Complex Conditions

In the previous post, the topic of ‘Using Conditional Statements’ finally, came to an end. But only now, there is something we call ‘complex’. Actually, the word, ‘complex’ means multiple. In fact, the complex is always something, multiple. A single complex object is a combination of multiple simple objects.

A simple example of a complex condition is given below:

bool complexOr = 5 < 3 || 2 < 8;


The whole expression after the assignment operator(or simply, = i.e equals to) gives either true or false and then, stores it in the boolean variable called as complexOr. 5 < 3 is understandable and is a simple condition when used alone. Same is the case for 2 < 8. First one is false and the second one is true. But the new thing is the operator in between these two simple conditions which connect them, forming a complex condition.

This is the OR logical operator(||) and it connects two or more conditions in such a way that:

If anyone of the conditions is true, it will return true.

For the above case, the boolean variable complexOr will hold true. This is because 2 < 8 is true.

There is another operator of which example is given below:

bool complexAnd = 5 < 3 && 2 < 8;


The two ampersands(&&) is called AND logical operator and it connects two or more conditions in such a way that:

If all of the conditions are true, it will return true.

Therefore, it is pretty, clear that complexAnd will hold false. This is because one of the conditions i.e 5 < 3, is false.

In the next post, we will talk more about complex conditions and calculations. Be easy with yourselves and don’t get panic about the amount of text. Be patient and practice programming on daily basis!

One response to “C++ Programming Series: Complex Conditions”

Leave a Reply

Your email address will not be published. Required fields are marked *