Be concise.
Be useful.
All contributions dictatorially edited by webmasters to match personal tastes.
Please do not paste any copyright violating material.
Please try to avoid dependencies to third-party libraries and frameworks.
old, x = x, new
generic function replace<T>(var X: T; NewValue: T):T;
begin
Result := X;
X := NewValue;
end;
begin
x := someoldvalue;
y := specialize replace<TSomeType>(x, somenewvalue);
end.
no strict 'vars';
($old,$x) = ($x, $new);
use strict;
my $old;
my $new = 'new thing';
my $x = 'old thing';
($old,$x) = ($x, $new);
old, x = x, new
old, x = x, new
std::mem::replace(&mut x, v);