Skip to content

Instantly share code, notes, and snippets.

@vanmichael
Created November 26, 2013 15:02
Show Gist options
  • Save vanmichael/7659829 to your computer and use it in GitHub Desktop.
Save vanmichael/7659829 to your computer and use it in GitHub Desktop.
Card Quick Challenge for Launch Academy
class Card
def initialize(rank = nil, suit = nil)
if suit.nil?
@suit = ['♠', '♣', '♥', '♦'].sample
else
@suit = suit
end
if rank.nil?
@rank = ['2','3','4','5','6','7','8','9','10','J','Q','K'].sample
else
@rank = rank
end
puts "Create a new card: #{@rank} of #{@suit}"
end
end
5.times { Card.new() }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment