From: Tom Sawyer Date: 2003-01-10T04:07:31+09:00 Subject: Re: so it seems there is no way to pass argument lists? On Thursday 09 January 2003 11:39 am, dblack@candle.superlink.net wrote: > There's nothing you can't do, by way of passing arrays around; you > just have to process them according to what you've asked Ruby to do. > In this case, if you have: > > def catchem(*args) > > then you have to get at args[0] to see the first argument -- which, in > this case, is itself an array. (It's not that the * in throwem does > nothing; it's that the way Ruby passes multiple return values is by > packaging them into an array.) > > def throwem > return 1,2,3 > end > > def catchem(*args) > args[0].length > end > > puts catchem(throwem) # 3 understood. thanks. unfortunately, i was trying to make my code a little neater: catchem throwthrew throwem rather then having to do: catchem *(throwthrew *throwem) oh well, i'll figure out another way. -- tom sawyer, aka transami transami@transami.net .''. .''. . *''* :_\/_: . :_\/_: _\(/_ .:.*_\/_* : /\ : .'.:.'. .''.: /\ : ./)\ ':'* /\ * : '..'. -=:o:=- :_\/_:'.:::. | ' *''* * '.\'/.' _\(/_'.':'.' : /\ : ::::: = *_\/_* -= o =- /)\ ' * '..' ':::' === * /\ * .'/.\'. '._____ * | *..* : |. |' .---"| * | _ .--'| || | _| | * | .-'| __ | | | || | .-----. | |' | || | | | | | || | ___' ' /"\ | '-."". '-' '-.' '` |_. ------------------------------------------------------------