Presentation is loading. Please wait.

Presentation is loading. Please wait.

How to repeat information outside of a function!

Similar presentations


Presentation on theme: "How to repeat information outside of a function!"— Presentation transcript:

1 How to repeat information outside of a function!
For Loops How to repeat information outside of a function!

2 Review!!! Which function will teach Karel how to spin in a circle one time? function spin() { turnRight(); } B. function spin() { turnLeft(); turnLeft(); turnLeft(); turnLeft(); } C. function spin() { turnLeft(); turnLeft(); } D. function spin() { move(); move(); move(); move(); }

3 Review!!! Why do we use functions in programming?
Break down our program into smaller parts Avoid repeating code Make our program more readable All of the above

4

5 What is the difference between a Function and a Loop?
A function is a way to make the code easier and quicker by eliminating repetition! A loop takes something that is repeated a lot and condenses it into one loop

6 When to Use loop and not Function
putBall(); …… x100

7 When to use Function and not Loop
Function moveAndPlace(); move(); putBall(); move(); putBall();


Download ppt "How to repeat information outside of a function!"

Similar presentations


Ads by Google