Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Logic and Conditional Block Dr. José M. Reyes Álamo.

Similar presentations


Presentation on theme: "Introduction to Logic and Conditional Block Dr. José M. Reyes Álamo."— Presentation transcript:

1 Introduction to Logic and Conditional Block Dr. José M. Reyes Álamo

2 2 Pending Items Post the following Labs into your OpenLab portfolio ASAP: –Android Zoo App –PaintPot –I started grading and most of you don’t have them. You must post them by midnight to get credit before I do my final round of grading. Post you final project idea into your OpenLab portfolio with the following information: –App you are planning to develop –Your team member –Even though you will work in groups, portfolios will be graded individually.

3 3 Outline Boolean expressions Relational operators If and Ifelse statement

4 Boolean Expression

5 5 AND operator AND operators (&) = All statements must be TRUE for the operation to be TRUE. STATEMENT 1STATEMENT 2AND Example: Check if the following operation is TRUE or FALSE X>10 & Y 10 & Y<=-4 If X = 11 and Y = 1 11>10 & 1 10 & 1<=- 4 If X=20 and Y -10 20>10 & -10 10 & -10<=-4 TRUE AND FALSE TRUE FALSE TRUE

6 6 OR operator OR operators (|) = At least one statement must be TRUE for the operation to be TRUE. STATEMENT 1STATEMENT 2OR Example: Check if the following operation is TRUE or FALSE X>10 || Y 10 || Y<=-4 If X = 11 and Y = 1 11>10 || 1 10 || 1<=- 4 If X=2 and Y =2 2 >10 || 2 10 || 2<=- 4 TRUE OR FALSE TRUE FALSE

7 7 NOT operator NOT operator (!, ~) = Inverts the Boolean value of a variable or expression. STATEMENT 1NOT

8 Logic Control if – if-else statement

9 9 If and ifelse statement Test statement If test statement is TRUE, then do the following… If test statement is TRUE, then do the following.. If test statement is FALSE, then do the following… If test statement is FALSE, skip the if statement

10 10 Algorithm – Pseudo Code // Use if statement to check the default size. defaultSize = 5; smallSize = 3; bigSize = 8; If defaultSize 3 Display in LabelResult = The dot size is set to default; end

11 11 ASSIGNMENTS Idea for final project due TODAY IN CLASS LAB: –LAB9 QuizMeQuizMe READING ASSIGNMENTS: –AppInventor CH20 (Repeating Blocks)AppInventor CH20 (Repeating Blocks) –AppInventor CH22 (Working with Databases)AppInventor CH22 (Working with Databases) READING ASSIGNMENT EVALUATION: –Complete the reading assignments (2 CHAPTERS) and answer the RA10_AppInventorCh20andCh22 on Blackboard. First draft for final project due NEXT WEEK.


Download ppt "Introduction to Logic and Conditional Block Dr. José M. Reyes Álamo."

Similar presentations


Ads by Google