File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -320,12 +320,13 @@ main: () = {
320320
321321Another example:
322322
323- ``` cpp title="Capture in a named function expression (aka lambda)" hl_lines="2 4 7 12 13 "
323+ ``` cpp title="Capture in a named function expression (aka lambda)" hl_lines="2 4 9 14 15 "
324324main: () = {
325325 price := 100;
326- func := :() = {
327- std::cout << "Price = " << price$ << "\n";
328- };
326+ func := // Note: 'func' is a named variable of deduced type initialized to ...
327+ :() = { std::cout << "Price = " << price$ << "\n"; } // ... this lambda
328+ ; // This is a way to declare 'local functions', which can also capture
329+ // (In the future, Cpp2 may directly support local functions)
329330 func ();
330331 price = 200;
331332 func();
You can’t perform that action at this time.
0 commit comments