user40922: I am working in ESP8266 AsyncWebserver library and have been using this [](parameter) as an argument to some functions as shown below but does not really know what it means. Being a neophyte I am curious to know what does this convention means, its functionalities and how to use it. Hopefully experts here would help me with this.

server.on("/page",HTTP_GET,[](AsyncWebServerRequest * request){
    some code....;
    request->getParam("Param1")->value();
});


user4143: That is called a lambda expression and it's a way of including the content of a function as a parameter anonymously instead of writing an actual function and using the name of it.
It's shorthand for:
void myCallback(AsyncWebServerRequest * request) {
    // some code....;
    request->getParam("Param1")->value();
}

// ...

server.on("/page", HTTP_GET, myCallback);

It does have a few benefits over traditional functions at the expense of readability, such as the ability to "capture" local variables from the surrounding scope.

40922: <p>I am working in ESP8266 AsyncWebserver library and have been using this <code>[](parameter)</code> as an argument to some functions as shown below but does not really know what it means. Being a neophyte I am curious to know what does this convention means, its functionalities and how to use it. Hopefully experts here would help me with this.
</p>

<pre class="lang-cpp prettyprint-override"><code>server.on("/page",HTTP_GET,[](AsyncWebServerRequest * request){
    some code....;
    request-&gt;getParam("Param1")-&gt;value();
});
</code></pre>
 4143: <p>That is called a <a href="https://en.cppreference.com/w/cpp/language/lambda" rel="noreferrer"><em>lambda expression</em></a> and it's a way of including the content of a function as a parameter anonymously instead of writing an actual function and using the name of it.</p>

<p>It's shorthand for:</p>

<pre><code>void myCallback(AsyncWebServerRequest * request) {
    // some code....;
    request-&gt;getParam("Param1")-&gt;value();
}

// ...

server.on("/page", HTTP_GET, myCallback);
</code></pre>

<p>It does have a few benefits over traditional functions at the expense of readability, such as the ability to "capture" local variables from the surrounding scope.</p>
