130 likes | 219 Views
Decision Statements. Control Stuctures. Sequential Processing Do In Order D o Together If / Else Statements Decisions Repetition Looping. If / Else Statements. Make a decision based on the value of a condition (at Runtime) If a condition is True Do “A”
E N D
Control Stuctures • Sequential Processing • Do In Order • Do Together • If / Else Statements Decisions • Repetition Looping
If / Else Statements • Make a decision based on the value of a condition (at Runtime) • If a condition is True • Do “A” • Else (meaning the condition is false) • Do Nothing • Do “B”
Boolean Functions • Functions returning a Boolean Value are often used in Decision Statements • If the function returns a True Value • Do “A” • If the function returns a False Value • Do Nothing • Do “B”
Relational Operators • 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
Compound Conditions • Compound Conditions can be used in the If Statements • Logical Operators • And • Or • Not
Example • 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
Boolean Function • Write a function (isGato) that returns true if the word “gato” is clicked and returns false otherwise. • Parameter – • objectClicked – the 3D word clicked by the user
checkAnswer Method • Event Handling Method Compound Condition
Homework • Chapter 6-2 • Problems 13, 14, & 16