Main content
Course: AP??/College Computer Science Principles?>?Unit 3
Lesson 5: ConditionalsCompound Booleans with logical operators
Problem
A game programmer uses this nested conditional in their online Four Square game.
IF (mouseX < 200 AND mouseY < 200) {
currentSquare ← 1
} ELSE {
IF (mouseX > 200 AND mouseY < 200) {
currentSquare ← 4
} ELSE {
IF (mouseX < 200 AND mouseY > 200) {
currentSquare ← 2
} ELSE {
IF (mouseX > 200 AND mouseY > 200) {
currentSquare ← 3
}
}
}
}
When
mouseX
is 173 and mouseY
is 271, what will be the value of currentSquare
??
Related content