Presentation is loading. Please wait.

Presentation is loading. Please wait.

Compound Conditional Logic

Similar presentations


Presentation on theme: "Compound Conditional Logic"— Presentation transcript:

1 Compound Conditional Logic
Lesson 3-20 AP Computer Science Principles

2 Objectives Students will be able to:
Evaluate compound conditionals composed of AND, and OR, and NOT operators. Write if statements in JavaScript that use boolean operators &&, || and !. Use AND, OR, and NOT operators to simplify the expression of compound boolean logic within a program.

3 Review Complete page 1 of the Compound Conditionals Worksheet.
Review your answers with someone else: Is my partner’s solution correct? Is my partner’s solution different from my own in any way? Are there ways we could improve our solutions?

4 If the day is any day but “Monday” the program writes “At least it’s not Monday”

5 If the user is a teenager the program writes “You are a teenager”
If the user is a teenager the program writes “You are a teenager”. Otherwise it writes “You are not a teenager”

6 If the day is a weekend day the program writes “It is the weekend”
If the day is a weekend day the program writes “It is the weekend”. Otherwise it writes “It is not the weekend”.

7 Compound Conditionals
Nested and chained conditionals are important tools when designing boolean conditions in our programs. In fact, every boolean condition can be expressed in some way using nesting and chained conditionals. That said, often when we write out these solutions they are long or force us to write redundant code. Today were are going to learn some new tools that won’t let us write any new conditions, but WILL allow us to write many complex conditions much more clearly.

8 Video

9 Compound Conditionals Worksheet and Stage 20
Complete pages 2-4 of the Compound Conditionals Worksheet. When done complete Stage 20.

10 Wrap-up What’s the trickiest logical statement you encountered in this lesson?  What made it tricky?


Download ppt "Compound Conditional Logic"

Similar presentations


Ads by Google