LarsGast / DeckOfPlayingCards

Simple code to play with a standard deck of 52 cards
MIT License
0 stars 0 forks source link

Throw exception when no card can be drawn #1

Closed LarsGast closed 1 year ago

LarsGast commented 1 year ago

https://github.com/LarsGast/DeckOfCards/blob/0792d0f81c546ee0919924a642c96b68a7431bff/DeckOfCardsLibrary/Deck.cs#L89C10-L89C10

Throwing an exception or simply letting the program crash here instead of returning null could be more intuitive. Research required.

LarsGast commented 1 year ago

The method will remain as is. It is not intuitive enough to throw an exception here. Returning null is a valid way of responding to the situation where no more cards can be drawn.