What is the difference between Set and Array in Ruby except for the fact that sets keep unique elements while arrays can keep duplicate elements?
Set
Array
They are very different.
a[3]
[1, 'apple', String, 1, :banana]
require 'set'
Set.new
Set[]
Set[1,2,3]
2.1m questions
2.1m answers
60 comments
57.0k users