Introduction to Functions
As I’ve mentioned above, a function is a block of programming code that performs a specific task. What makes functions so cool is that they really cut down on the amount of code that you have to type. Instead of having to type in the same code every time you want to perform a task, you can just call the function, instead. This cuts down on the size of your scripts, and makes typing the script much less prone to error.
Also, after a function has been called the first time, it resides in system memory, which can enhance the performance of your scripts.
You can create functions that accept parameters from the main program, that return values to the main program, or that might do some stand-alone task that doesn’t involve either passing parameters or passing values. Learning to create functions is easy, because for the most part you’re just using the same coding techniques that I’ve already shown you. I mean, yeah, there are...