Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In the above example, there are three functions: the main function is called "newsstats". Within this function, there are two subfunctions; one called "mean" and the other, "median". The subfunction is defined the exact same way as the main function; but the difference is the subfunction can only used when the main function is used - you can not call your subfunctions in the command window. As you can see, the main function calls both of the subfunctions, making the code much shorter and simpler. For longer, more complex code, this can save you a lot of debugging time by breaking down your code into smaller pieces.

That brings us to the end of this tour. Before we part, let's remind ourselves of some important programming guidelines that we have followed in this tour:

...