Functions are pieces of code and they’re terrific! You use them when want to do something specific! Learn about what are functions and what functions can do with our latest coding song and video on functions. Functions in coding has never been so fun!
Lyrics
Functions are pieces of code and they’re terrific!
You create them to do something specific
And functions can have all the stuff we talked about before
Like variables, loops, conditions, and more!
The best thing about functions is they are designed
To be used and reused many many many times!
A function is a bunch of code that has a set of steps to complete a specific action
And you may not realize it
But in a way you complete functions in your own life every day, all the time
When you brush your teeth
Or tie your shoes
Or get on the bus
To go to school
You’re completing a set of steps in order to do something specific
And that’s just like a function!
Functions are pieces of code and they’re terrific!
You create them to do something specific
And functions can have all the stuff we talked about before
Like variables, loops, conditions, and more!
The best thing about functions is they are designed
To be used and reused many many many times!
So let’s create a function together to get our robot friend to roast us a
marshmallow!
The first thing we need to do is name the function to remind us what
it does, so we are going to name this function roastIt!
Inside the roastIt function we need to code the steps, which are
Find a marshmallow
Poke the marshmallow through the stick
Hold the stick over the fire
Wait until the marshmallow is brown but not black
Take the stick away from the fire
Pull the marshmallow off and voila!
We just made a function!
Functions are pieces of code and they’re terrific!
You create them to do something specific
And functions can have all the stuff we talked about before
Like variables, loops, conditions, and more!
The best thing about functions is they are designed
To be used and reused many many many times!
So let’s talk about the best thing about functions
They are reusable!
Remember all those steps that went into creating the function?
Well, the next time you want to roast a marshmallow, you don’t have to say all those
steps again, you can just call the name of the function
Want another marshmallow right now?
Just call roastIt!
Want one tomorrow?
That’s right, just call roastIt!
What about in six months?
Uh huh, roastIt!
And here’s another cool thing
Functions can be created to be adaptable!
You could use the same function with the same steps and bring in other things to
roast, like hot dogs! I sure do love functions!
Functions are pieces of code and they’re terrific!
You create them to do something specific
And functions can have all the stuff we talked about before
Like variables, loops, conditions, and more!
The best thing about functions is they are designed
To be used and reused many many many times!