The name of this video is function organization. So there are two sticking points, I would say, with starting to use functions and learn to use functions. And the first one of those is the fact that we can organize our code in a nonlinear fashion that we can call functions from anywhere within the code. And at first, this seems, we're anti to the structure that we've been writing code so far, which is really in a linear fashion where we move from the top to the bottom. And that's certainly going to be disrupted by using functions. But you'll eventually see the advantage of functions to be able to access things and pass data around in the code in different ways rather than just in a single stream, so that's one of the points. The other point, which I'll get into more detail in this video is how that data is moved between calling a function and moving data into a function and then how it's named within that function and then use within the function. And there's a couple of sticking points within that things will need to clarify. But the first thing I want to do is just take a code, our pair down code that we've been using and translate it into a function structure. And so, this is pretty simple, Dictionary point matrix code that's creating a curve. Okay, so how do we begin to break this up into functions? There's this part here where I have my input values. And typically what we do with any sort of input data that we're getting from Rhino space from a user, we're going put it into a part of a function called main. And that function main is usually put down at the bottom of the code. So I'm going to go below everything here. And I'm also going to go outside make sure I go outside all indents. And I start with def to define the beginning of my function, write the name of the function, followed by close parentheses and then a colon. And then when I hit Enter, I should get an indent. So now anything that's indented is going to be within that function. So I'm just going to take this part of the code up here, cut it out, And put it in my main. And make sure it's all indented. So I'm still inputting my maximum in my x and my maximum and my y. And I want to use that data to call a new function which I haven't created yet, which is really my point, matrix C, so the rest of this code. So I'll come up with an appropriate name. And let's call it PointMatrix. And again, remember like variables and tuples, and lists and dictionaries all have the same naming conventions apply for function names to. And also the fact that we have to write them exactly the same everywhere that we use them in the code. If we don't write them the same, then we're going to get an error,syntax error. Okay, so I'm going to call that function and in calling that function, I'm going to give it two arguments. Imax and jmax. So I haven't created that function yet. But so I don't make a mistake, I'm just going to select its name and copy it. And then we'll go up here to the top. Now I don't want to put my import modules inside a function. So usually I just have them at the top of the code with any information about the code, and the name of my code up here. So I want those outside of this function. So def again, followed by space and the name of the function, Then close parentheses and a colon. Now I'm going to put imax and jmax here. And I want to make sure all of this stuff that I have within that function is indented. So it's contained within that function. And then you'll see I get this little line here that shows me what's contained within that function. So, this piece of data, which by default is 10, is saved in this variable. And then 10 is put here in the variable and the call of the function and then that's passed up here to the function, imax. And then from that point on,anytime I refer to imax within the function, it refers to whatever data is pushed through there and let's say reassign it at some point within the function. So the last thing I need to do, Is call main. So, this input of data is what really prompts my running of my code, Or at least it's the beginning of my code, the running of it. Because that is now contained within the function, if I don't run the function then I'm not going to get these questions asked. So I can run this. So I will do this. So we could run this and nothing happens. Nothing breaks but nothing happens. I'm not getting asked questions in the comment line, and it just brings me back to the editor. That's because I'm not prompting the running of main. So it's not going to run PointMatrix, because PointMatrix is contained, or its call, I should say, is contained, within the main function. So to get everything going, I have to go all the way outside of the main function and write main close parentheses. So that is the call of the main function, And then it should run. So now it's running asked main input in x direction 10, input y 10. Now, as I said one of the other sticking points is how data is passed through a function. And really what these, variables are placeholders for data. So they allow me to pass it through up here. Now I could change this, and I often do, I'll change this to a capital. And then anywhere else in the code, in that function, I need that to be exactly the same if I want to reference that data, If wanted to get it to run. So someone would ask, why do this? Why change that name? And one of the reasons that I do it, is because it signifies that that data has been passed into a function. Because this is written in this way in a lowercase, its signifying that's outside of that function. Once they pass it inside of this function, I changed the name slightly by capitalizing it. And if I look at the function it lets me know that there is a relationship between this and this, but something has changed because it's sort of been passed into this function. So it is a tool for sort of clarity and in looking at the function. Now, the other sticking point is that there's no functional relationship between what this use here and this down here, okay? So this could be CAT and DOG. And as long as I write it the same way in here, CAT and DOG, That code is going to work fine because all it's doing is, Being a conduit through which the data is passing, Okay? So that's a tricky point to understand. We'll run this, make sure it works. Works fine. So that's a tricky point to understand. Again, we use naming conventions because they tell us a little bit of something about the data that's being held. CAT DOG doesn't really tell me too much about that data. And also, the fact that I changed it slightly from the call, lets me know that I've, called this function and that now I'm using that data inside of the function And we'll look at a couple more sort of custom function examples. But from this point on, we're going to be writing things in this structure as functions so we'll have plenty of time to get used to this structure.