Functions vs Loops

Function is a code used to perform an action. For example, “turn Left” function makes the turtle turn left and “moveForward” function makes the turtle to move forward.

Loop is used to repeat a certain action more than once to reduce the length of the function needed in programming. For example, instead of writing “moveForward” 5 times, you can put “moveForward” function into the loop only once and assign the loop to 5 repetition to make the turtle to move forward 5 times.

Leave a comment

Design a site like this with WordPress.com
Get started