Functions
A set of instructions that can be called upon to perform a specific task. This is also called a subroutine. You would write a "function" if it's something you plan on using repeatedly. Instead of writing the code over and over again, you would write it once as a function and call it when you need it.
Every Day Life Examples
|
Classroom ExampleAt school if the fire alarm goes off, then you line up with everyone else who is near you and you walk out of the building in a quiet and orderly manner. You do this regardless of where you are and what time it is. You could be in the gym for PE or in math class. If the fire alarm goes off, you do the same set of instructions. You can think of it as a "function".
|