Adam Block wrote: > Hi all. > > Let's say I want to either create a new named array or append to that > array if it already exists. Is there a more elegant way of doing the > following? > >>> @foo[:bar].nil? ? foo[:bar] = ["snafu"] : foo[:bar] << "snafu" I would use: @foo[:bar] ||= [] @foo[:bar] << "snafu" There probably is more compact, but I find this writing very readable when you're used to it (though, admittedly somehow puzzling for the beginners). Cheers, Vince -- Vincent Fourmond, PhD student http://vincent.fourmond.neuf.fr/