 So we want to do a little bit more than just that single expression just that single block of code that can be executed As in the mathematical expression we saw before but what if we want to do a little bit more? We've got to use a different syntax and this is what we do We're actually going to declare this block of code. We're going to declare this function So we use this keyword function and then we give it a name. I've called it MLTPL for short for multiple Any name except for keywords and a few other Normal Julia restrictions that you can't use but certainly MLTPL is no problem again It's going to take two arguments and I'm going to call them x and y The first thing that is going to happen when this function is called It's going to print a line and it's going to print a line that says The following and inside of a string the first value is and then we have this dollar x sign This x refers to that x and this dollar refers to the fact that this is a placeholder So we will look at strings in a different lesson, but This is how you would use it most of the time I think So just putting in that placeholder and that dollars sign is an escape sign just to say look Don't print that but print the actual value that is inside of that variable and then the second value is that and Which is the y that comes from the value that's passed there and then we have this backslash in Combination and that is this shorthand for new line So it's just going to be like a inter key or the return key carriage return and then we're going to have The dollar x again the value that's an x then this x which is this Multiplied I suppose in string format and then the value of y is colon and End and then we see this return keyword and it's going to take the value That's an x and multiplied by the value that's in y and we end all functions have to be ended So this indentation that you see that happens automatically a for me and I Julia and You'll also note. There's no colon that we put after that as we might do in other languages such as Python This is picked up by this into by this interpreted self By I Julia itself. I should say these indentations forming this block of code So let's execute that it gives us back this name Remember before gave us back the name if but this time I've called it ML TPL and it says It's a generic function with one method again method is all about multiple dispatch and we're going to get to that now Let's call this function by passing two arguments to it Now I call the function this function our lives in memory and all of its methods actually as I said We'll get to that multiple dispatch we call it and we pass a value for x and a value for y It's in that order. These are ordered arguments x comes before y the first thing that I pass is going to go into x The second thing I pass after the commas going to go into y So let's see what happens just as we expect we get this string and it says The first value is 3 and the second value is 4 so see that dollar x sign and dollar y sign those were placeholders It passes the actual values to it and then we see the 3 times 4 is and that is what is returned It returns the value that is x times y and indeed that is 12 now Do we always need this return key? Let's see what happens if we emit That keyword so here we have another function. I'm going to call it MLTPL 2 takes two arguments x and y Now this x and y it's this placeholder for placeholders for what gets passed So you're going to print another little string and this time I'm just using blah blah blah multiply doesn't matter All I want to show is that x times y. There's no return So let's see what happens now It is a function a generic function with one method no problem Let's call it and pass two values blah blah blah multiply again 12. So I didn't need that return keyword But look at this we go a bit crazy. I've got this new function I'm calling it MLTPL 3 again with two arguments print more blah blah now I have x plus y and x times y what's going to happen now. So don't be confused by using this Name here multiply or some short ad for multiply. That was just my choice. I could call it anything within reason But I'm passing to express I've got two expressions here, and I've got no return What is going to happen again? It's a generic function with one method, but now let's see what happens I'm passing a 3 comma 4 are we going to see 7 and a 12? No, we are not This is what we're going to see blah blah more blah blah blah, and then we only see 12 So what Julia does is it will just automatically return this last line and it's going to ignore this It lives some way I suppose but nothing can you can't do anything with it. It's this last line It will take this last line, which is x times y Now it needn't just be the one thing remember it was just one thing we did here in the last line That's 12. We can actually do some more look at this new math function of mine a and b Print so again these are just placeholders before we use Dexon y note that I now use a and b That's going to print this function will return addition subtraction and multiplication of the values and then my placeholders a and b and again this escape Backslash and to get the full stop there and then I'm going to have a plus b comma a minus b comma a times b Now what's going to happen now because it's all in the same line Is it just going to do the a times b? There's no return keyword because anything after the return will certainly be used Let's see what happens and I'm going to call it with three and four and then you see my string this function will return addition subtraction multiplication of the values three and four and I get this tuple back the tuple with three values seven minus one and twelve and That becomes very useful. So first of all, we've learned that it is the last line irrespective of there being commas in it will be returned Now because it's three things that are returned I can actually use three computer variables of name them once one once two once three four So I would say answer one two and three call this math function with its two arguments and There we have we get the return of this string with a placeholders three and four and the tuple that it returns But now I can ask what was answer one and indeed answer one was seven Referring to the fact that I got a tuple back of three values So if I do this kind of assignment I'm going this is going to be seven. This is going to be negative one and this is going to be 12 so it comes a useful way of dealing Of using functions now we've looked at two forms of syntax to create our functions in The next section we're going to concentrate a little bit more on these arguments I'm going to show you how to deal with optional arguments and default of values You