Functions let you group a series of statements together to perform a specific task. If different parts of a script repeat the same task, you can reuse the function (rather than repeating the same set of statements).
Declaring a function
To creat a function, you give it a name and then write the statements neesed to achieve its task inside the curly braces.
Calling a function
Having declared the function, you can then execute all of the satements between its curly braces with just one line of code.
Declaring functions that need information
Sometimes a function needs specific information to perform its task. In such cases, when you declare the function you give it parameters. Inside the function, the parameters act like variables