myarray.select{ |x| x % 2 == 1 }.collect{ |x| x + ", " } #.join here ?
Again, can we use Enumerable method on Array? And, { |x| x % 2 == 1} will
compare the element itself, not the index of the element, right?
Shannon
···
Protect your PC - get McAfee.com VirusScan Online
Antivirus, VPN, Identity & Privacy Protection | McAfee
The answer is ‘yes’ in both cases.
(was too literal
···
On Wed, Dec 04, 2002 at 12:29:23AM +0900, Shannon Fang wrote:
myarray.select{ |x| x % 2 == 1 }.collect{ |x| x + ", " } #.join here ?
Again, can we use Enumerable method on Array? And, { |x| x % 2 == 1} will
compare the element itself, not the index of the element, right?
–
_ _
__ __ | | ___ _ __ ___ __ _ _ __
'_ \ / | __/ __| '_
_ \ / ` | ’ \
) | (| | |__ \ | | | | | (| | | | |
.__/ _,|_|/| || ||_,|| |_|
Running Debian GNU/Linux Sid (unstable)
batsman dot geo at yahoo dot com
Never make any mistaeks.
– Anonymous, in a mail discussion about to a kernel bug report