Re: swapping two numbers

"Leonid Grinberg" <[email protected]> Fri, 23 Jun 2006 18:25:09 -0400
Newsgroups gmane.comp.lang.perl.fun
Message-ID <[email protected]>
> not in-place cause it's 3 lines, but does not use an external temporay
> value, and should be language-independent:
>   x = x + y
>   y = x - y
>   x = x - y
> (IIRC my high school BASIC teacher taught us that)

Yeah, that works. Who said that it can't be 3 lines.