Logic and if Statements

1 project
1 article
6 challenges
6 talkthroughs
Teach your program to make decisions!

If Statements

Jessica introduces if statements, a way for your program to decide whether or not to execute a block of code.

More Mouse Interaction

Pamela explains how to use mouseIsPressed with if statements to execute code only when the user is pressing their mouse.


Jessica introduces the idea of "booleans", values that can either be true or false.

Logical Operators

Pamela shows how to use different logical operators (like && and ||) inside if statements.

If/Else - Part 1

Jessica introduces if's soulmate: else.

If/Else - Part 2

Jessica shows how to make your conditionals more powerful with "if else".

Project: Magic 8-Ball

In the logic challenges, you practiced if and else. Now, use that knowledge to program a magic 8-ball, so you can ask your programs for answers to all your deepest life questions. Change the if() so it checks if the answer variable is a ...