You are on page 1of 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