Hailes the strings are the hardest.
Once again welcome to the next video of Codlin fundamentals.
Now in this video let us not proceed and check out what is the syntax to define functions in Coquelin.
So our typical method in case of Codlin appears to be like this.
So we have a keyword this matter name.
These are the arguments and this is the return type.
And then here we return something.
So our typical method in case of Cartland has some syntax such as this is the one keyword.
This is the method name.
These are the formal parameters such as length and breadth.
And here are the end I have returned by now to define a return type.
You have to simply use a colon followed by a space and followed by the return type such as integer string
boolean and so on.
And now here with the help of this method we are actually finding the area of a tangle or something
like that.
So here I am simply returning length into bread which is equivalent to integer value that we have defined
here.
Now apart from the don't die the methods can also return void.
That is.
It has also got the right to return.
Nothing so far that the syntax is this right.
So here function fine area length and breadth.
And here instead of void in Cartland we are using Unix.
So this unit is actually equivalent to the void in Java right.
So if you don't want to return anything in Scotland then simply use galloon space unit.
No aspell the Cartland Gordon convention.
If you'd done nothing then you don't need to define this unit explicitly here.
By default if you don't define anything here then also the code will work.
So if you want to you can also remove this unit from here.
It is of no use and now inside the intelligent ID inside our Kaytee file.
Let us try to write our first function.
Let's see if you are in space a function to add two numbers.
They simply define the method body and radio record inside this.
So here I would simply define the variable of let's see a equal to two and then that would be equal
to let's see forward.
And now here I will simply print though some of these two numbers.
Or if you want you can also define that sum equal to a plus b like this.
And then finally and then finally at the end I will simply print the sum such as some is let's see a
list B on insert of this.
You can also use the entire politian.
That is the string in the politian actually studied in the previous videos right.
So curly bracket open and close along with a prefix of a same.
And I guess I forgot to use some very well here.
So as of now let us remove this right.
So this completes our called.
Now the question arises from where we are going to call this method of error.
We don't have any main method defined in case of Cartland.
So here I would simply define my toplevel main method which is actually equivalent to public static
void main.
In case of Java programming so let us define the fun main here.
Just go on Adye of string.
Right as simple as that.
And we already know all these things from the previous values of discourse so simply call this ad Metford
And now let us run the code.
And remember this main method is actually the entry point of your application.
So this method will simply call Add method which in turn will simply print apers be sorted out and the
called in the output.
We have some is 6 and now let us make it print LN and then run the code again.
So this makes our output better.
Right.
And now if you know this here this argument does not return anything.
So here you can also use clone space unit which is actually equal into void.
In case of Java no aspell that Cartland coding convention you don't have to specify you need.
If you don't return anything.
So by default every method returns unique.
That is weird.
So you can remove it and it will work perfectly fine.
Right.
And now suppose I want to pass these two variables as paramita.
So for that part I really do.
I will simply pass to my food here and now let us remove these two lines of code and then specify variable.
A clone of the type of and comma variable be all of the type of end.
And now here I am simply printing all the values inside the function.
And so let us know.
And they're called So this is how we pass the argument in case of Cartland.
So some is sixth grade.
And now suppose our requirement is that let us bring this statement inside the main method not here.
That is we want in return the sum of these two numbers so far out of our day will do is I will simply
use that sum equal to add two numbers and then I will simply correct this statement and paste it here.
And instead of this let us use let's say dollar some light that string politian Or alternatively you
can also use less.
Right.
So no issue in this as well.
Now here I have to return the sum of inby so that I can print it here right.
So far that I have simply written legacy return a less B and now it simply shows an error type mismatch.
Now the return type is Bideford is unique.
Now here we are returning the endangered value.
So instead of unit latest type capital I N D.
So this method simply returns the sum of these two numbers and still it inside the very the variable
the sum.
And then we print it out here.
So let us know.
And they're called.
So here we get some is 6.
So this was all about the basic syntax for the functions in case of Cartland.
So get you guys in the next video.
Thanks for watching.
Have a good day.