Hash of arrays - initialization (was Re: Beyond YAML? (scali

Brian C. wrote:

samples[tag] ||= []
samples[tag] << sample

And you can probably combine:

(samples[tag] ||= []) << sample

Thanks; I figured the magic || operator was somehow
involved, but I still don’t have that thing memorized…
yet more aggressive incompetence. :slight_smile:

Thanks again,

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs