> On Jun 20, 2022, at 8:39 PM, Michael Van Canneyt via fpc-pascal
> <[email protected]> wrote:
>
> It allows you to run callbacks without having to declare variables globally:
>
> Function DoSomething : String;
>
> var
> L : TStringList;
>
> begin
> L:=TstringList.Create;
> SomeCallBack(procedure(s : string)
> begin
> L.Add(S);
> end
> );
> Result:=L.Text;
> L.free;
> end.
>
> With a regular procedure or procedure of object, you'd need to define L
> outside of DoSomething.
I think you could use “is nested” and it would work also but see my other email
with my example of a plain procedure which seems to capture for some reason.
Regards,
Ryan Joseph
_______________________________________________
fpc-pascal maillist - [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal