A function is a block of organized, reusable code that is used to perform a single, related action. Functions provide better modularity for your application and a high degree of code reusing. Functions are like recipes- once we’ve
defined them the Turtle can repeat them as many times as we like.
In this Trinket there is a function called
make_triangle that gets
To see the working run this code and also try these things to understand the concept.
call it more times?
Can you duplicate and make a new function that makes a new shape?
Functions don’t have to be the same every time. We can pass them different
parameters which can change their behavior.
say function below takes parameters we’ve named
words and then tells Tina to say those words.
To see the working of program run this code, also try these things and modify accordingly.
Change the parameters of the functions to change what Tina says.
call the function again to make Tina say more things
Change what Tina does in the function
Advanced: Make Tina yell by making the words UPPERCASE