1 / 1100%
Named after mathematician George Boole.
A Boolean expression has only two possible values: true and false
Examples:
My favorite color is purple -> true
I am scared of spider -> false
5=5 -> true
32 > 33 -> false
If x = 5 & y = 10
X<20 -> true
y = 5 -> false
Wrap- Up Questions
1. Boolean expressions equal:
a. Numbers may have decimals
b. True or False
c. Number without decimals
d. 1 or 2
2. Which of the following variables is a Boolean?
a. ticketPlane
b. teamName
c. isWinning
d. numTickets
3. Consider the following code.
What will be displayed when the Boolean expression is true? How about false?
If (box.contains(point))
{
output.setText(“hit”);
}
Else
{
output.setText(“miss”);
}
Powered by TCPDF (www.tcpdf.org)
Booleans:
Students also viewed