CS160: Foundations in Programming: Summer 2016
Logical and Comparison Operators
Here is a list of the comparison operators that can be used in conditions:
> (greater than)
< (less than)
!= (not equal to)
<= (less than or equal to)
>= (greater than or equal to)
Please note that the test for equality consists of two equals signs, rather than one.
x = y;
means that x becomes equal to y. But the expression:
x == y
means a test to see if x is equal to y.
Suppose we want to test more than one thing at once. The and ,
or , and not are logical operators using in
composing the conditional expressions. The complete list of logical
© 2016 CS160 Colorado State University. All Rights Reserved.