What do you want to save?
Add Code snippet
New code examples
-
Ruby 2022-03-18 08:10:03
ruby get the number of same element in array
names = ["Jason", "Jason", "Teresa", "Judah", "Michelle", "Judah", "Judah", "Allison"] counts = Hash.new(0) names.each { |name| counts[name] += 1 } # => {"Jason" ... Add solution -
Ruby 2022-03-16 19:55:01
iterate over array ruby
array = [1, 2, 3, 4, 5, 6] array.each { |x| puts x } Add solution