Hello, in this video, I am going to show you how to pass in arguments into a function argument is basically a fancy term in coding for value information and a variable essentially. And at the moment, what we have is this function that just prints out 12345. And let's actually pass something in. So to pass a value in, all you do is first where you created your function. You create a variable here, so I'm gonna call this VA one. And now if we go back and we try and reload, we get an error.
And that is because there's too few arguments to function cor 11 on line two well, and the reason there's too few because we haven't passed anything, it's on this pass something in and we're just going to pass in a string. So I'm gonna say I put my name and what do they To do anything, because we haven't actually used a variable, so let's actually use it so we can use it here. Bar one. There we go. We have it passed in. And what we could do is pass in another one.
So we pass in Batman. As you can see, it gets through, you might think in Can you pass in more than one variable? And yes, you can. You can literally just put a comma, then the next variable name, does it have to be called var one. I'm gonna call it epic. Why?
Just to demonstrate that you can call it whatever you want. And this is expecting a nova value now, so I'm going to put it up as Superman. Yeah. I'll put one of my middle names here. Okay, doesn't crash, and it won't show anything because I haven't actually used it yet. So if I save that rerun it, we get it all printing out nicely.
So you could think of this instead of Hello. Imagine if this was a high school function. And you are sensitive for different games, printing out the high school, this should still work. So what I want you to do with an extra task is extend this. So we accept five variables. And I'm actually going to rename this so it's name one.
So it's good to have variable names that are descriptive of what they are storing should still work yet extend it so it takes them five names and print them out like this. And you could even maybe separate the number with a colon a dash or something else. So that's it for this video. If you have any questions. Feel free to pop me a message and as usual, I look forward to seeing you in the next video.