Wozu dann überhaupt das
with
, wenn man doch wieder die Variable
fb benutzen muss?
Im Prinzip hast Du recht.... Das geht aber noch weiter:
Zitat:
When the expression for the with statement is a Record or other value type, the new variable acts as an alias to toe original record, and any changes done on the identifier will directly affect the original record.
By contrast, assigning the record to a new local var declaration would create a copy opf the record on the stack:
Delphi-Quellcode:
var x: Person;
x.Name := "Peter";
with y := x do
y.Name := "Paul";
// x.Name is now Paul
Compared to:
Delphi-Quellcode:
var y := x;
y.Name := "Paul";
// x.Name is unchanged, as y is a separate copy