Homework Help

What is a compound conditional expression?

user profile pic

brandih | eNotes Employee

Posted June 25, 2013 at 9:24 PM via web

dislike 0 like

What is a compound conditional expression?

1 Answer | Add Yours

user profile pic

justaguide | College Teacher | (Level 2) Distinguished Educator

Posted June 26, 2013 at 2:14 AM (Answer #1)

dislike 1 like

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.


Join to answer this question

Join a community of thousands of dedicated teachers and students.

Join eNotes