Hello and welcome to the golden programming language course in the previous session, we talked about
function arguments.
And in this session, we want to talk about the other functions concept.
Anonymous function in gold language.
Google AdWords provides a special feature known as an anonymous function, an anonymous function is
a function which doesn't contain any name.
It's useful when you want to create an inline function in goal.
Language and anonymised function can form a closer and anonymous function is also known as functionality.
Right now, you can see the syntax.
In this case, we want to examine the defensive stays of the anonymous function.
First, simple, anonymous function.
Second, in go language, you are allowed to sign an anonymous function to a variable term.
You can also pass are humans in the anonymised function and Foles function defined to exit a parameter
and return value?
Now go to your school program to illustrate how to create an anonymous function.
First, simple, anonymous function, first, write the following keyboard, open and close parentheses
and curly brackets.
Now write our codes in body of font fold in example.
50. Printed and set the message and end of closed broadcast.
It's another open and close parenthesis and execute the program.
Now do you sample?
Fine, open and close Francis's curly brackets and end of the close brackets put open and close, prompted
again and in the body of function.
Write your statements for the example, if be then called to go through the rhyming language, reformat
the code and see the project execute the code.
Now we can see the output welcome to go programming language, defined and anonymised function and execute
it and see the printed message.
Second, set in goal language, you ought to know to sign an anonymous function to evaluate the first
clear last code,
define the local variable like resolved calling equals and create an anonymous function and assign it
to defined very the fine, open and close parenthesis curly brackets and display in the sage fine print
at function FP.
Welcome to blue language.
When you assign the function to a variable, then the type of the variable is a function type and you
can command a variable like function call as shown in this case, resolved open and close PRANCES is
reformat to call and see if the project and execute the program.
Now we can sit out with welcome to go language first, we define an anonymous function and assign it
to a value.
So type of variable changes to function time then invoke variable as a function, an anonymous function,
execute and see the printed receipts.
Turn to the state.
You can also pass arguements in the anonymous function first to your last school.
Define an anonymous function.
Phone open Frances's and set parameters as passing arguments and anonymised function like name as string
Typekit and go to the body of function and display the created parameters by the brain function, follow
the example of p name.
Put an open and close parenthesis and in this prances is the initialize our parameters for the exam
pattern.
Welcome to the language reformat the code, says the project and execute the program.
Now we can see the with.
Welcome to go language, in this case, we define an anonymous function and set a parameter and initialize
it so we could pass arguments in the anonymize function and force function defined to accept a parameter
and return value.
First, clear the last call.
We want to return value of area of a rectangle and display it first, right, a display message and
create an anonymous function inside it.
For the example, at Earth, correct angled area by 10, value equals per cent the back end.
And here, for initialize the conversion character, we create an anonymised function that return the
value.
So do the following.
You, for the example, the Pirates are like that and you buy time off and return while you eat.
And clearly rockets and we want to calculate rectangle earlier.
So return W multiplication W and end of curly brackets in the panties is set the parameter for the example
10 value v format.
They call and say the project and execute the program.
Now we can see the output rectangle area by 10, value equals 100.
We could define an anonymous function that accept the promise or return a value we have reached end
of decision.
I hope you have taken full advantage of decision until next session.
Goodbye.