# What is a compound conditional expression?

*print*Print*list*Cite

### 1 Answer

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.

**Sources:**