ruby array unique


/ Published in: Ruby
Save to your folder(s)



Copy this code and paste it in your HTML
  1. #!/usr/bin/env ruby
  2.  
  3. a = [0,1,2,3,4,5,2,3]
  4. p a.select{|e| a.index(e) != a.rindex(e)}.uniq

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.