15 lines
224 B
Ruby
15 lines
224 B
Ruby
#!/usr/bin/env ruby
|
|
|
|
def cards_of_suit(cards, suit)
|
|
cards.select { |card| card.include?(suit) }
|
|
end
|
|
|
|
cards = [
|
|
"7 of hearts",
|
|
"king of clubs",
|
|
"10 of hearts",
|
|
"ace of spades"
|
|
]
|
|
|
|
puts cards_of_suit(cards, "hearts")
|