From: Prasadhnc C Date: 2013-02-01T16:17:31+09:00 Subject: Re: Why Array#include? not working withone liner integer arrays? --bcaec54eedd6c0f90b04d4a46d2e Content-Type: text/plain; charset=ISO-8859-1 `inculde?' -> check the spell it should be include? On Fri, Feb 1, 2013 at 12:31 PM, Arup Rakshit wrote: > I was trying to write a one liner with integer array using > array#include?,which is not working.But the same is good with > character/string array. > > C:\>irb > irb(main):001:0> a=[1,2,3] > => [1, 2, 3] > irb(main):002:0> a.include?(1) > => true > irb(main):003:0> a.include?(5) > => false > irb(main):004:0> [1,2,3].inculde?(1) > NoMethodError: undefined method `inculde?' for [1, 2, 3]:Array > from (irb):4 > from C:/Ruby193/bin/irb:12:in `
' > irb(main):007:0> b=[".vbs",".exe",".h"] > => [".vbs", ".exe", ".h"] > irb(main):008:0> b.include?(".rb") > => false > irb(main):009:0> [".vbs",".exe",".h"].include?(".rb") > => false > irb(main):010:0> [1,2,3].inculde?(1) > NoMethodError: undefined method `inculde?' for [1, 2, 3]:Array > from (irb):10 > from C:/Ruby193/bin/irb:12:in `
' > irb(main):011:0> > > Could you please if is it possible what I am looking for or I did the > mistake? > > Thanks > > -- > Posted via http://www.ruby-forum.com/. > > --bcaec54eedd6c0f90b04d4a46d2e Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
`inculde?' -> check the spell
it should be include?
On Fri, Feb 1, 2013 at 12:31 PM, Aru= p Rakshit <lists@ruby-forum.com> wrote:
I was trying to write a one liner with integer array using=
array#include?,which is not working.But the same is good with
character/string array.

C:\>irb
irb(main):001:0> a=3D[1,2,3]
=3D> [1, 2, 3]
irb(main):002:0> a.include?(1)
=3D> true
irb(main):003:0> a.include?(5)
=3D> false
irb(main):004:0> [1,2,3].inculde?(1)
NoMethodError: undefined method `inculde?' for [1, 2, 3]:Array
=A0 =A0 =A0 =A0 from (irb):4
=A0 =A0 =A0 =A0 from C:/Ruby193/bin/irb:12:in `<main>'
irb(main):007:0> b=3D[".vbs",".exe",".h"]<= br> =3D> [".vbs", ".exe", ".h"]
irb(main):008:0> b.include?(".rb")
=3D> false
irb(main):009:0> [".vbs",".exe",".h"].incl= ude?(".rb")
=3D> false
irb(main):010:0> [1,2,3].inculde?(1)
NoMethodError: undefined method `inculde?' for [1, 2, 3]:Array
=A0 =A0 =A0 =A0 from (irb):10
=A0 =A0 =A0 =A0 from C:/Ruby193/bin/irb:12:in `<main>'
irb(main):011:0>

Could you please if is it possible what I am looking for or I did the
mistake?

Thanks

--
Posted via http://= www.ruby-forum.com/.


--bcaec54eedd6c0f90b04d4a46d2e--