We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aaa5b72 commit 8c9e810Copy full SHA for 8c9e810
docs/cpp2/expressions.md
@@ -320,12 +320,13 @@ main: () = {
320
321
Another example:
322
323
-``` cpp title="Capture in a named function expression (aka lambda)" hl_lines="2 4 7 12 13"
+``` cpp title="Capture in a named function expression (aka lambda)" hl_lines="2 4 9 14 15"
324
main: () = {
325
price := 100;
326
- func := :() = {
327
- std::cout << "Price = " << price$ << "\n";
328
- };
+ func := // Note: 'func' is a named variable of deduced type initialized to ...
+ :() = { std::cout << "Price = " << price$ << "\n"; } // ... this lambda
+ ; // This is a way to declare 'local functions', which can also capture
329
+ // (In the future, Cpp2 may directly support local functions)
330
func();
331
price = 200;
332
0 commit comments