--- In [email protected], Edwin Pratomo <[EMAIL PROTECTED]> wrote:
>
> 
> --- Rie! <[EMAIL PROTECTED]> wrote:
> 
> > What i want to ask is more about language design
> > cos I might've lost reading it from ruby-core
> > mailing list and i've tried googling around but
> > found nothing, what's the meaning of ruby compact
> > actually if its output return result is just the
> > same like the array before.
> > 
> > ex.
> > 
> > a = [ :a, :b, :c ]
> > a << [ :a, :b ]
> > => [ :a, :b, :c, [ :a, :b ] ]
> > a.compact
> > => [ :a, :b, :c, [ :a, :b ] ]
> > 
> 
> lho .compact kan buat filter out nil values, ri?
> (tiap kali lihat .compact jadi inget mr Kamal :-) hi there ! :-)

here you go . even more fun ;-)

m:~ arie$ irb19
irb(main):001:0> a = [ :a, :b, :nil, :c ]
=> [:a, :b, :nil, :c]
irb(main):002:0> a.compact
=> [:a, :b, :nil, :c]
irb(main):003:0> a << [ nil, nil, :a ]
=> [:a, :b, :nil, :c, [nil, nil, :a]]
irb(main):004:0> a.compact
=> [:a, :b, :nil, :c, [nil, nil, :a]]
irb(main):005:0> 


> rgds,
> Edwin
> 
> 
> 
> 
>       
> ________________________________________________________ 
> Kunjungi halaman depan Yahoo! Indonesia yang baru! 
> http://id.yahoo.com/
>



Kirim email ke