Workshop › Blackjack › Step 9 of 22
Going over 21 is a bust, so an ace that would cause it counts 1 instead of 11. As long as the total is over 21 and an ace still counts 11, we take 10 off.
```js
// Aces count 11, unless that would bust the hand: then they count 1.
while (total > 21 && aces > 0) {
total -= 10
aces -= 1
}
```aces counts the aces still worth 11, so we never take off more than we may.handValue, write the comment.return total, write the while loop.Skills: Loops
← What is a hand worth? Hit: one more card →