# Lesson Set 4 - CS 1136 LAB 4 Boolean and Relational...

This preview shows pages 1–2. Sign up to view the full content.

CS 1136 LAB 4 Boolean and Relational Operators, Chain Logic, and Conditional Operators Boolean Expressions To ask a question in a program, you make a statement. If your statement is true, the answer to the question is yes. If your statement is false, the answer is no. To ask a question, you need to use the following relational and Boolean operators. Relational Operators == Equal to != Not equal to > Greater than < Less than >= Greater than or equal to <= Less than or equal to Boolean Operators && AND: Takes two operands. If both operands are true (not equal to zero), the result is true. Otherwise, the result is false. || OR: Takes two operands. If at least one of the operands is true, the result is true. Otherwise, the result is false. ! NOT: Takes only one operand. If the operand is true, the result is false. If the operand is false, the result is true. Precedence Since only one operation can be executed at a time, we need precedence of operators to determine the order of execution in a statement with multiple operators. This table includes arithmetic, Boolean and relational operators from highest to lowest precedence. Operators with the highest precedence are executed first followed by operators with the next lowest

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/30/2012 for the course CS 1136 taught by Professor N/a during the Fall '08 term at University of Texas at Dallas, Richardson.

### Page1 / 3

Lesson Set 4 - CS 1136 LAB 4 Boolean and Relational...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online