Michiel Helvensteijn wrote:
Leandro Lucarella wrote:A more general solution is supporting tuples in the language, then you can do something like: a, b = b, a;That's a great feature. But even if it's available, I'd use swap, because: * I wouldn't have to mention each variable twice * It would use move-operations rather than copy operations Parallel assignment is still useful for other stuff, like traversing the fibonachi sequence with two variables :-) (a, b) <- (b, a + b);
Or when you need to reorder more than two variables:
a, b, c, d = b, d, a, c;
Jerome
--
mailto:[email protected]
http://jeberger.free.fr
Jabber: [email protected]
signature.asc
Description: OpenPGP digital signature
