Guilherme Mello wrote: > How to create the repeat method: > > [:one, "two", 3].repeat(3) > > Result: > > [:one, :one, :one, "two", "two", "two", 3, 3, 3] > > Thanks. I solve this using this method: def repeat n new_array = Array.new self.each { |x| n.times do new_array.push x end } new_array end Thanks. -- Posted via http://www.ruby-forum.com/.