Boolean Expressions and If Statements
Focus on Ifs, Switch, Expressions and how to build control structures in Java.
Expression, Assignments, and Condition Statements
All of the Units have video series. We have access to information and content for College Board and Code.org. Below are two sample videos, it is up to you to determine the detail or brevity that you will need according to your experience.
- AP Classroom Boolean Expressions
- Code.org If and Conditions, less than 2 minutes
// All of the boolean expressions below evaluate to true
if (true) {
System.out.println("True code block");
}
if (true && !false) {
System.out.println("True and Not False code block");
}
if (true || false) {
System.out.println("True or False code block");
}
if ((true && !false) && (true || false)) {
System.out.println("Confusing code block");
}
if (!((false || !true) || (false && true))) {
System.out.println("De Morgan's law in my head of confusing code block");
}
// Can any of the above expression be simplified? What would they simplify to? Are any of these expressions useful?
Hacks
Build your own Jupyter Notebook lesson on ifs
- Explain if, if-else, and if-elseif-else.
- Make a markdown block before you sample code
- Comment in code to describe each decision
Add to lesson switch-case
- Create and if-elseif-elseif-elsif-else statement, 5 or more conditions.
- Covert the 5 or more decisions to a switch-case-case-case-case-otherwise.
- Make a markdown block before each code example
- Comment/establish a style of comments for your if-elseif and switch-case code blocks
Finish lesson with De Morgan's law
- Describe De Morgan's law
- Illustrate De Morgan's law
- Show some code running that shows understanding
Resources, it is really time to show you can find resources beyond the Teacher. Code/Code/Coding is everywhere, find something that helps.
- Code.org Unitt 4 section 1 to 5 can help with some ideas.
- AP Classroom unit 3 has outline for unit
- CodeAcademy has some online resources