DEV Community

Discussion on: Explain Lambda expressions like I'm five

Collapse
 
sammyisa profile image
Sammy Israwi

Are you familiar with JavaScript? If so, think of Lambda expressions as anonymous JavaScript functions.
Where in JavaScrip you would have

const square = (x) => x*x;
square(4); //would return 16

in C# you would have

del Square = x => x * x;
Square(4); //would return 16

You would use Lambda expressions anywhere where you would need to pass a function.

Hope that helps!