Presentation is loading. Please wait.

Presentation is loading. Please wait.

Decision Statements. Control Stuctures Sequential Processing Sequential Processing Do In OrderDo In Order Do TogetherDo Together If / Else Statements.

Similar presentations


Presentation on theme: "Decision Statements. Control Stuctures Sequential Processing Sequential Processing Do In OrderDo In Order Do TogetherDo Together If / Else Statements."— Presentation transcript:

1 Decision Statements

2 Control Stuctures Sequential Processing Sequential Processing Do In OrderDo In Order Do TogetherDo Together If / Else Statements  Decisions If / Else Statements  Decisions Repetition  Looping Repetition  Looping

3 If / Else Statements Make a decision based on the value of a condition (at Runtime) Make a decision based on the value of a condition (at Runtime) If a condition is True If a condition is True Do “A”Do “A” Else (meaning the condition is false) Else (meaning the condition is false) Do NothingDo Nothing Do “B”Do “B”

4 Boolean Functions Functions returning a Boolean Value are often used in Decision Statements Functions returning a Boolean Value are often used in Decision Statements If the function returns a True ValueIf the function returns a True Value Do “A” Do “A” If the function returns a False ValueIf the function returns a False Value Do Nothing Do Nothing Do “B” Do “B”

5 Relational Operators Used in Expressions for If Statements Used in Expressions for If Statements ==Equal To !=Not Equal To <Less Than >Greater Than <=Less Than or Equal To >=Greater Than or Equal To

6 Compound Conditions Compound Conditions can be used in the If Statements Compound Conditions can be used in the If Statements Logical OperatorsLogical Operators And And Or Or Not Not

7 Example Problem 6-2, #11 Problem 6-2, #11 Write a vocabulary builder to help someone learn the Spanish word for Cat (gato). 3 Spanish words are displayed, if the user clicks on the correct word have the cat say “Si, Si”, if the user clicks on one of the other words have the cat shake it’s head back and forth

8 World Creation

9 Boolean Function Write a function (isGato) that returns true if the word “gato” is clicked and returns false otherwise. Write a function (isGato) that returns true if the word “gato” is clicked and returns false otherwise. Parameter – Parameter – objectClicked – the 3D word clicked by the userobjectClicked – the 3D word clicked by the user

10 isGato Function

11 checkAnswer Method Event Handling Method Event Handling Method Compound Condition

12 Link Method to Event

13 Homework Chapter 6-2 Chapter 6-2 Problems Problems 13, 14, & 16


Download ppt "Decision Statements. Control Stuctures Sequential Processing Sequential Processing Do In OrderDo In Order Do TogetherDo Together If / Else Statements."

Similar presentations


Ads by Google