Google News
logo
Dart - Interview Questions
What is Lambda Function?
* Lambda is a short way to represent tiny functions.

* Arrow functions and lambda functions are both terms for the same thing.

* However, keep in mind that you can only return one expression with the Lambda function syntax. It can only be a single-line expression. A lambda function cannot run a block of code, just like a regular function.

* To summarise, if your function only returns one expression, you can use the lambda function to quickly represent it in only one line.

Example :
void main() {
printMsg();
print(test());
}
printMsg()= >
print("hello");
int test()= 123;
// returning function​
Advertisement