KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
For learning purposes, what is this called? Is the object being created an array or a hash? stack_of_cards = [] This is how I'm filling it: stack_of_cards << Card.new("A", "Spades", 1) stack_of_cards << Card.new("2", "Spades", 2) stack_of_cards << Card.new("3", "Spades", 3) ... Here is my Card class: class Card attr_accessor :number, :suit, :value def initialize(number, suit, value) @number = number @suit = suit @value = value end def to_s "#{@number} of #{@suit}" end end I'd like to shuffle the elements in this array/hash (what is this called? :S) Any suggestions?
Tags (comma-separated)
Save Edits
Cancel