Why we choose lambda functions while there is a better way? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why we choose lambda functions while there is a better way?

I can't get the usage of lambda functions.

16th Jun 2018, 6:27 AM
LAWArthur
2 Answers
0
lambda functions are jst for a particular purpose, instead of writing a function of 3 lines, lambdas shorten it to just a line, if u want to test or check something in a program, use lambdas
16th Jun 2018, 6:53 AM
ghali lawal
ghali lawal - avatar
0
lambdas are often used if you want to declare a function on the fly, for example a small callback for something asyncrounous or a function that you can apply to a vector using std::transform and similar functions or more general when you need to pass a small function to a function
16th Jun 2018, 8:02 AM
Max
Max - avatar