What is a compound conditional expression?

Asked on by enotes

1 Answer | Add Yours

justaguide's profile pic

justaguide | College Teacher | (Level 2) Distinguished Educator

Posted on

A basic conditional expression is one in which a particular input variable is tested; the result of the same determines what the value of an output variable is.

For example, consider the expression (x == 4). Here, the variable x is being tested. If it is equal to 4, the condition is true, else it is false.

A compound conditional expression has more than one condition being tested and the the final result is determined with the use of logical OR (||) and AND (&&) operators.

For example : if((x==1) || (x != 4)) is true if either x is equal to 1 or x is not equal to 4. Similarly if((x>1) && (x<6)) is true for values of x lying between 1 and 6.


We’ve answered 319,814 questions. We can answer yours, too.

Ask a question