Download presentation
Presentation is loading. Please wait.
Published byΚύμα Οικονόμου Modified over 5 years ago
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
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();
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.