From: Jamis Buck Date: 2003-12-12T07:49:57+09:00 Subject: Re: Simple issue giving problems Brad wrote: >a=1 >b=2 > >def swapper(dest,src) > dest,src=src,dest >end > >swapper(a,b) >p [ a, b ] > > > Well... given that the swap is only a one-liner, you really don't need to do the function call at all. However, I understand there is a deeper issue here--sometimes you want to modify the parameters... What I usually do is just return the modified parameters, like this: def swaper( dest, src ) dest, src = src, dest return [ dest, src ] end a, b = swapper( a, b ) p [ a, b ] -- Jamis Buck jgb3@email.byu.edu ruby -h | ruby -e 'a=[];readlines.join.scan(/-(.)\[e|Kk(\S*)|le.l(..)e|#!(\S*)/) {|r| a << r.compact.first };puts "\n>#{a.join(%q/ /)}<\n\n"'