 functions. Attributes, parameters, and arguments. Alright team, welcome back. It is your biggest fan of The Real Casadero and in this vlog we're talking about the difference between arguments, attributes, and parameters when it comes to functions and functional programming. If you're a beginner, perfect because I'm going to try to explain this in the most simple way I can. Understanding what these different things are is going to help you wrap your head around how they work a little better and it also will help you have better conversations. And also learn faster and learn more because when you go out to read people are going to be using those kind of terms and you'll have a very firm understanding of what they are. First we're going to start with the function altogether. So a function is basically just a block of code that does something that you want it to do. So it's like a it's a machine. Just think of it as a machine. A machine where you put something in and it goes out and it does some kind of thing or maybe it returns to you some sort of some sort of object or thing. So maybe in terms of the real world so let's say we have a microwave. A microwave performs a function. We take something cold and we put it in the microwave and we turn it on. We say do your microwave thing for x amount of seconds or minutes or whatever. When it's done it beeps at us to tell us it's done and we open the microwave and we get out hot food. The microwave has performed a function. Some functions they just do whatever it is they do like say for instance the thermostat in your house. You set the temperature to one thing and whenever the temperature gets there it just does this thing. You don't have to go to the thermostat and do anything. So you don't have to provide the thermostat with any arguments at least not on the regular basis. Going back to the microwave analogy it doesn't make any sense to microwave nothing. So we're always providing something to the microwave that needs to be microwaves in this and so we can call our food that we're putting in the microwave an argument. We have to give the mic if it just makes sense to give the microwave an argument so it can perform its function and make food warm. Now we can run the microwave any time we want but it's not going to do anything but eat up energy and in the case of a computer if you run a function that's not doing anything maybe it'll eat up memory and it'll eat up a little bit of electricity and if you do this enough times it'll add up and so arguments are things that we feed into functions. Inside of the function we have we have parameters. Parameter would be say for instance in our case of the of the microwave that you have to enter a time. When we feed our argument to the microwave along with that argument so we got one argument that is food another argument may be the amount of time we want the microwave to do this thing that is going to do. So we push a bunch of buttons and we hit start and then the microwave does this thing. What we got is we have the microwave function that takes an argument of food it takes an argument of time and then it starts doing this thing and when it's in when it ends it beeps and that would be what that function performs but inside of that function it has the parameters I have to have so food may be an optional parameter. So if we don't give the microwave food the microwave doesn't really care so maybe there's nothing that there's no parameter inside of the function to handle food other than to take it in into say this is the food I'm going to cook and this is the food that's going to be returned when I'm done but if there's no food the function would just say I didn't receive anything so I'm not going to return anything and then your other parameter would be the amount of time that the microwave has to operate and then you have a method inside of this function which is essentially another function that says when the start button is clicked turn on these things inside of the microwave and leave them running for this amount of time and when they're done make the microwave and then our food is done. Now we know that an argument is something that we give to a function a function is just this tool it's this machine that does something that we've pre-programmed it to do and the machine may return a value or it may not it maybe it doesn't need to return a value or it does its operation because it didn't require that value in the first place then inside of the function you have a method which is essentially another function which does some other thing depending on what has happened in that function already and then that's where you can get into like the really complicated things about programming so hopefully that breaks it down a little bit for you and helps you understand functions and arguments and parameters a little better and I didn't mention I don't think I mentioned attributes they sit inside of the function and they give this function certain characteristics so different microwaves may have different characteristics like wattage or or or the way the ringer sounds or whatever we could say this microwave has these attributes and this microwave has these attributes so maybe this microwave is 50 watts and so we have to cook our food it doesn't take as much time to cook the food and this microwave is 25 watts so it takes twice as long to cook the food or maybe there's some sort of other way that microwave works I don't I maybe microwaves was a bad analogy to begin with this microwave may have a different method for the way we inner time or or something like that in this or the way it it counts what it does when we hit the start and button maybe on this microwave when we hit the start button the food starts to cook but then there's a beep every second for the countdown so that would be an attribute of this microwave and we would there would be a attribute in there that says sound beep alarm you know this kind of beep and stuff like that and if you understand programming understand exactly what I'm talking about if not this should help you wrap your head around it attributes are just features that a piece of code has and in this case a function so we've got our argument again that we feed to the microwave we have the attributes the microwave has different ways it's going to cook this food different things is going to do while it's cooking it cooking this food and then it has different methods for doing different things when the food is done or why the food is cooking or whatever and these methods can be called when we feed in our arguments to our function all right team so that is it if you like this video leave a thumbs up if you didn't like it leave a thumbs down at any rate comment so I know what you're thinking about and we can have a conversation and you guys can meet each other and talk to each other and learn more stuff from each other and grow together and become successful and prosperous as a big happy bunch of people on the internet also subscribe if you like me and you like the stuff that I'm talking about this is just a reminder subscribe and hit the bell the notification bell and click it so it so you get the things around it and it and that tells you whenever a new video is produced and it is uploaded to the internet so you can come and you can watch it and you can be entertained and you can learn a little more and you can be inspired and motivated then you can get on with your day all right team it is your biggest fan the real Casadero I will see you in the next vlog