Hello, and welcome. In this lesson, you will learn about lambda expressions, what they are, and what they do. So what is it? a lambda as a way of representing a function. It means an expansive way of doing something. So in our case, a lambda expression is a short block of code, which can process another function maybe, or it can process a certain set of parameters and return a value. So when Kotlin and lambda expressions are similar to functions, but they do not need a name, and they can be implemented right in the body of another function. So a lambda expression, or as we might say, just simply a lambda, is an anonymous function, a function without a name. These functions are passed immediately as an expression without the needs of declare it. So lambdas are about speed and simplicity, and lambdas are considered one of the most powerful tools in Kotlin, or any other modern language. Since it allows modeling functions in a simpler way. The only way we can do certain things in Java is by declaring an interface with a single method. But in Kotlin, lambdas can open up an infinite world of possibilities. Okay, so how do we define a function that accepts lambdas? Let me go over to my main activity. This is our program. So within my main activity here, I'm gonna define a variable. I'm gonna say Val, I'll call this variable greeting. I'm just gonna say hello to somebody. Val-greeting-equal, open curly braces, I'm gonna say println, Hello, good morning. Just a simple greeting. Now, right now, this variable, isn't gonna do anything because nothing has called it yet. So let's run it to show you what I mean. I'm gonna open up the logcat here, and I'm gonna open up my terminal, and I'm going to run this app. Gradle is building, the emulator is building, my emulator appears, I'm gonna move it over so that we do what we're doing. Okay, the program finished running, and look here, we have an error message, and then saying "the expression println cannot be invoked as a function." So I'm gonna go back to my code, and I'm going to fix that simply by invoking a lambda. And here's my lambda, I don't need to declare a function, I don't need to give it any name. I'm just gonna invoke the greeting function, by saying greeting. So a lambda expression is assigned to variable greeting, without a name. So I'm gonna run it again, and look at this, our IDE provided this for us. In Kotlin to invoke a lambda, we need to have this private operator called Any.invoke, and it saw that we were doing a lambda, so the IDE gave it to us. Okay, now we're ready to run it. I don't need those, and I'm gonna apply the changes and restart, building and running, changes succeeded, I'm gonna run the app, the launch succeeded. Now I'm gonna bring up my emulator. This is my app, I'm gonna click on the button. Now let's look at the logcat, I'm gonna run and there we go. Our lambda function printed out. "Hello, good morning." Just as we asked it to. So here a lambda expression is assigned to a variable greeting. Greeting acts like a function, but it does not have a name or declaration of a function, it is anonymous, it is a lambda. So we are invoking what is essentially a function, but we call it a lambda expression, and that lambda expression is invoked as greeting. So that is our lesson on lambda expressions. Thanks for watching. Stay tuned for the next lesson.