From: Arup Rakshit Date: 2013-01-12T20:33:08+09:00 Subject: Re: Array methods creating confusions as per their functionalities Arup Rakshit wrote in post #1092023: > Alex van der Ruchei wrote in post #1092021: >> Try reading http://apidock.com/ruby/Array/zip etc. > > Wow nice docs you have provided! its too handy to understand as it > explains everything with small codes. > > let me look into the docs you just provided. > > Thanks for your time! to understand the ZIP method i used the below code,but getting an error.I might overlooked the bad area.can you help? irb(main):008:0> a = [ 4, 5, 6 ] => [4, 5, 6] irb(main):009:0> b = [ 7, 8, 9 ] => [7, 8, 9] irb(main):010:0> [1,2].zip(a,b) => [[1, 4, 7], [2, 5, 8]] irb(main):011:0> a.zip([1,2,]){|i|i>4} NoMethodError: undefined method `>' for [4, 1]:Array from (irb):11:in `block in irb_binding' from (irb):11:in `zip' from (irb):11 from C:/Ruby193/bin/irb:12:in `
' irb(main):012:0> a.zip([1,2,]){|i|i>4} NoMethodError: undefined method `>' for [4, 1]:Array from (irb):12:in `block in irb_binding' from (irb):12:in `zip' from (irb):12 from C:/Ruby193/bin/irb:12:in `
' irb(main):013:0> a.zip([1,2,]){|i|(i>4)} NoMethodError: undefined method `>' for [4, 1]:Array from (irb):13:in `block in irb_binding' from (irb):13:in `zip' from (irb):13 from C:/Ruby193/bin/irb:12:in `
' irb(main):014:0> a.zip([1,2,]){|i|i>4} NoMethodError: undefined method `>' for [4, 1]:Array from (irb):14:in `block in irb_binding' from (irb):14:in `zip' from (irb):14 from C:/Ruby193/bin/irb:12:in `
' irb(main):015:0> Thanks! -- Posted via http://www.ruby-forum.com/.