Problem with Counting Cards

I do not understand what is the reason why it does not work it.

switch (card){
case 2:
case 3:
case 4:
case 5:
case 6:

count ++;
return "Bet";

break;

case 10:
case ‘J’:
case ‘Q’:
case ‘K’:
case ‘A’:

count --;
return “Hold”;
break;
}

if (count>0){
return count + " Bet ";

}else if (count <0)
return count + " Hold ";

count ++;
return "Bet";
break;

count --;
return “Hold”;
break;

The return statement will stop and exit from the function execution, meaning that you won’t reach the bottom if statements.

Are you sure, you want to return there? :slight_smile:

1 Like

Vielen Dank mein Freund,