Hi there, in this screencast I'm going to cover modular programming. Now a lot of the code that I'm going to show is quite complicated and you haven't really learned a lot of it, but I wanted to just kind of show you as you're learning programming how to program in a modular fashion. Now let's say you are writing code, you're writing a lot of lines of code and you're doing the same thing in a lot of different procedures. So you're using parts of the code quite often. What you can do is you can make kind of the sub contracted subs. For example this someSub one, you could write by itself. So this thing is sort of a stand alone sub. Similarly, this someSub two would be a standalone sub, that maybe you're using quite often and then maybe you have a function. So essentially what you've got is, you've got these different subroutines that you can call on. So you have your main flow here, you go into your someSub and you contract out your first sub, you contract out to the next sub and then you maybe you have a calculation where you're contracting out to some function. So each of these functions and subs these procedures works on its own and then you kind of put them together into a modular program. So I've got an example here, I've got some data and we're going to develop a modular program for this. I've got a bunch of data just 25 datapoints and unfortunately some students over at school and mine's got a hold of this and they messed it up. Occasionally we've got 9999's, in there and then we've got some words that have just been typed in there. What I'm trying to do, is make a modular program called analyze data, it's going to first subcontract out some work to this remove 9999 sub and then it's going to eliminate the text. So wherever I have words is going to eliminate that and just replace it with blanks and then the next thing I'm going to do is, I'm going to remove the outlier. So this is a statistical method and then finally am going to calculate the statistics in particular the average and the standard deviation and we're going to output that in the message box. So each of these subs, is a standalone sub that can work on its own and then we can put that together into our analyzed data subroutine. So I've written all the code here and again this is a little bit more complicated than I would expect you to know at this point in the course, we're just getting started but the main thing is I've got my main sub here. This sub contracts out to the removed 9999. So it'll actually go into here you refer to it, you subcontract out those different subs using the call statement, so we eliminate the text and we return back to the main flow. This line here is a special statement that just removes any row that has a blank in column AA in this case and then we're going to remove outliers, so we call "Remove outliers subroutine. " We are going to remove any outliers that don't fit in with the other data points. Then finally we're going to call "Calculate stats" after we've eliminated all the 999999's, all the text in our original selection and then remove the outliers we are going to calculate the average and standard deviation of the data. So I want to show you how each of the different subs that are in our modular program kind of work independently. So first of all, let's play the remove 999's, so I make that selection and I'm going to remove the 9999's. So it eliminates the 9999's. I've also thought let's also run the removed or the eliminate text, so that one works by itself and then finally the remove outliers. So you notice that I have got some data here and the two here and the 19 are actually outliers, so we run the "remove outliers" and we eliminate those and finally then on the remaining, if we have some data here I can do calculate statistics and run that and it'll give me the average of the remaining data, so the filtered data with the outliers removed and then the standard deviation. So we can put it all together then because we have a bunch of modules. I've got the code here and let me just zoom out. So I'm going to make a selection, select all that data, and now if I just run the analyzed data, so that's the one that has them altogether, it just does everything in one fell swoop, right. So filters the data and spits out the average and standard deviation. So that's how you can orient or design your programming to be modular. Think in terms of different snippets of code that they could stand by themselves and you can use for other applications. Thanks for watching.