Chapter 3- Data Types and Operators Boolean Expressions Page 2 3 4

Introduction

The If Statement Page 2 3 4 5 6 7 8 9
Arithmetic Operations Page 2 3 4 5 6 Boolean Operators and Nested If Statements Page 2 3 4 5 6 7
Events and Sequential Processing Page 2 3 4 5 More Examples Page 2 3 4 5 6 7 8 9 10 11 12
Datatypes and Conversions Page 2 3 4 5 6 7 Using Check Box and Option Controls Page 2 3 4 5 6 7 8 9 10
Variable Declarations - Local and Global Page 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Exercises Page 2 3 4 5 6 7 8
Chapter 4- Selection Statements Review Questions
Introduction

4-5: Boolean Operators

Introduction

Sometimes it is necessary to combine two (or more) boolean expressions. For example, a ticket price might be $10 for child or pensioner, which might be expressed as

If (age < 12) or (age > 65) Then
price = 10
End If

where the condition is a combination of the two boolean expressions (age < 12) and (age > 65).

That word, or, used in the expression is called a boolean operator. Just as an arithmetic operator such as + takes two numeric values (as operands) and produces a new numeric value, so too the boolean operators take two boolean values (operands) and produce a new boolean value.

In other words boolean operators operate on boolean data. Most boolean operators are binary operators - meaning that they operate on two boolean values. Some are unary operators - meaning they operate on one boolean value.

There are a number of boolean operators that we'll examine in this section.