❔ Ace value of 1 or 11
I am writing a blackjack game. I have written a method to calculate the amount of "score" the player has. But the method has two separate foreaches. That is not necessarily how a method should be coded. Is there a way to remove one of the foreaches? so it fits the definition of a method?
9 Replies
uh
A method can have 69 foreaches nested inside of 420 wheres
It's still a method
(also, why
virtual
..?)looks ok as is
Can u not just use an else
Oh nvm
Ye that’s fine
you could use an else to make it more performant
count the number of aces in the one loop and in the second loop, loop for that count
cause its inside an abstarct class. Im just practising all i learn. Putting it all to use.
Well at uni, they teach us that there cant be 2 seperate fors or foreaches as that goes agains the principles of OOP. Nested fors and foreaches are good.
They're full of shit, then
what
But no worries
Most schools are
Well the logic is that one method should do only one thing
Seems unreasonable
But it is what it is 🙂