Presentation is loading. Please wait.

Presentation is loading. Please wait.

© A+ Computer Science -

Similar presentations


Presentation on theme: "© A+ Computer Science -"— Presentation transcript:

1 © A+ Computer Science - www.apluscompsci.com

2 © A+ Computer Science - www.apluscompsci.com
What is a LOOP? © A+ Computer Science -

3 © A+ Computer Science - www.apluscompsci.com
the loop Until I can hear the song Make it louder Loops repeat as long as something is true If statements are just simple decision-making statements. A condition is checked and something may or may not happen based on the evaluation of that condition. © A+ Computer Science -

4 © A+ Computer Science - www.apluscompsci.com
the loop As long as I am hungry I eat something While I have pretzels I eat one If statements are just simple decision-making statements. A condition is checked and something may or may not happen based on the evaluation of that condition. © A+ Computer Science -

5 © A+ Computer Science - www.apluscompsci.com
Loop Demonstration loop if ( student is hungry and more pretzels left ) { student will eat pretzel stick } condition © A+ Computer Science -

6 © A+ Computer Science - www.apluscompsci.com
Loops are used to repeat a command or set of commands forever or for a set number of times. © A+ Computer Science -

7 © A+ Computer Science - www.apluscompsci.com
When the green flag is clicked, the Bug will say "looping" for 2 seconds and then wait 2 seconds before saying it again. This loop will run forever. © A+ Computer Science -

8 © A+ Computer Science - www.apluscompsci.com

9 © A+ Computer Science - www.apluscompsci.com
open loop_one.sb © A+ Computer Science -

10 © A+ Computer Science - www.apluscompsci.com
When the green flag is clicked, the Bug will say "looping" for 2 seconds and then wait 2 seconds before saying it again. This loop will run 5 times and then stop. © A+ Computer Science -

11 © A+ Computer Science - www.apluscompsci.com

12 © A+ Computer Science - www.apluscompsci.com
open loop_two.sb © A+ Computer Science -

13 © A+ Computer Science - www.apluscompsci.com
What is an If? © A+ Computer Science -

14 © A+ Computer Science - www.apluscompsci.com
the if statement if I am hungry I eat something if I am tired I go to sleep If statements are just simple decision-making statements. A condition is checked and something may or may not happen based on the evaluation of that condition. © A+ Computer Science -

15 © A+ Computer Science - www.apluscompsci.com
the if statement if it is dark I turn a light on if I can’t hear the song I make it louder If statements are just simple decision-making statements. A condition is checked and something may or may not happen based on the evaluation of that condition. © A+ Computer Science -

16 © A+ Computer Science - www.apluscompsci.com
When the green flag is clicked, the Bug will say ouch each time it is clicked with the mouse. © A+ Computer Science -

17 © A+ Computer Science - www.apluscompsci.com

18 © A+ Computer Science - www.apluscompsci.com
open if_one.sb © A+ Computer Science -

19 © A+ Computer Science - www.apluscompsci.com
When the green flag is clicked, the Bug move back and forth across the screen. He will say Wow and Yahoo if he is at a certain position on the screen. © A+ Computer Science -

20 © A+ Computer Science - www.apluscompsci.com

21 © A+ Computer Science - www.apluscompsci.com
open if_two.sb © A+ Computer Science -

22 © A+ Computer Science - www.apluscompsci.com
Complete a Scratch Lab. © A+ Computer Science -


Download ppt "© A+ Computer Science -"

Similar presentations


Ads by Google