From: Farrel Lifson Date: 2008-02-10T07:09:23+09:00 Subject: Re: Identifying On 10/02/2008, Adam Akhtar wrote: > If you have an array which contains a mixture of say intergers and > nested arrays, how can you determine whether an element is an array or > not > > ie in psedo code > > array.each do |x| > if x == Array > do something > end > > whats the corect way to write the if statement? Use a case statement: array.each do |x| case x when Array: do something when Integer: do something end end Farrel