What is the role of the return statement in a lambda function? 

  • To indicate the end of the lambda function. 
  • To return a value from the lambda to the calling function. 
  • It determines the type of the lambda. 
  • It can't be used in lambda functions.
Lambda functions, like regular functions, can return values. If the lambda's body contains more than one statement, a return statement can be used to specify which value is returned. If the lambda's body consists of a single return statement, the return type is automatically inferred by the compiler.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *