From: Ian Whitlock Date: 2007-07-28T04:24:58+09:00 Subject: Re: How to pass arguments by reference in a function Lloyd Linklater wrote: > My question is, which is more efficient? It may depends on the definition of efficient. Try it with a = "13" and b = "17". In terms of execution time it is a horse race that doesn't matter much. Try require "benchmark" include Benchmark n = 100001 bm(10) do |x| a = 13 b = 17 x.report("XOR") {n.times {a ^= b;b ^= a;a ^= b} } puts a , b x.report("ruby") {n.times {b,a = a,b} } puts a , b end Ian -- Posted via http://www.ruby-forum.com/.