I found this code online that helps me with my homework, but I don't understand what it means. What I want to do is create a method called "handScore" that adds together the ranks of a card array. The value of each card is basically what their rank is, However, if the rank of the card is a jack, queen, or king, the value will simply be 10 and ace has a value of 1.
This is the code I found
public static int handScore (Cards[] cards){
int handTotal = 0;
for(Cards c : cards) {
int cardTotal = c.rank;
if(cardTotal > 10){
cardTotal = 10;
}
handTotal += cardTotal;
}
return handTotal;
}
My main confusion is about the colon in line 3, what does that do?