0% found this document useful (0 votes)
29 views13 pages

Boolean and Logical Operators

This document discusses Boolean and arithmetic operators. It defines Boolean variables as variables that can have one of two values, True or False, represented by the bool data type. Boolean expressions are expressions tested by if statements to evaluate to True or False. Boolean operators like AND, OR, and NOT are used to combine Boolean expressions and evaluate conditions. Arithmetic operators perform mathematical operations on numeric values.

Uploaded by

shaikh zulfa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views13 pages

Boolean and Logical Operators

This document discusses Boolean and arithmetic operators. It defines Boolean variables as variables that can have one of two values, True or False, represented by the bool data type. Boolean expressions are expressions tested by if statements to evaluate to True or False. Boolean operators like AND, OR, and NOT are used to combine Boolean expressions and evaluate conditions. Arithmetic operators perform mathematical operations on numeric values.

Uploaded by

shaikh zulfa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

BOOLEAN AND

ARITHMETIC
OPERATORS
BOOLEAN OPERATORS
BOOLEAN VARIABLES

• Boolean variable: references one of two values, True or False


• Represented by bool data type
• Commonly used as flags
• Flag: variable that signals when some condition exists in a program
• Flag set to False  condition does not exist
• Flag set to True  condition exists
BOOLEAN EXPRESSION

• Boolean expression: an expression tested by the if statement to determine if it is true or


false
• Example: a > b
• True if a is greater than b; False otherwise
• > is the relationship
• a > b is an expression
BOOLEAN OPERATOR

• The logical operators and, or and not are also referred to as boolean operators. While and
as well as or operator needs two operands, which may evaluate to true or false, not
operator needs one operand evaluating to true or false.
EXAMPLE
BOOLEAN FUNCTION
BOOLEAN FUNCTION
ARITHMETIC OPERATORS

• Arithmetic operators are used with numeric values to perform common


mathematical operations
EXAMPLE A=10 & B=20

You might also like