是否可以在 If 语句中使用 2 个数学条件?

Is it possible to use 2 Mathematical Conditions in a If Statement?

我正在创建一个二十一点程序。我需要检查 if the dealer's hand is greater than the players hand and also less then 21.

变量

dValue1 is the dealer's first card
dValue2 is the dealer's second card
pValue1 is the player's first card
pValue2 is the player's second card

我试过这样做:

if(dValue1 + dValue2 > pValue1 + pValue2 && < 21)

但我收到以下错误: 类型不匹配:无法从 int 转换为 boolean。 运算符 && 对于参数类型 boolean、int 是未定义的。

如果有人可以建议另一种方法来做到这一点,或者如果我只是犯了语法错误,我将不胜感激。

澄清一下:我想检查庄家的牌面值是否大于玩家的牌面,但也小于 21。

您必须将条件一分为二。

if ((dValue1 + dValue2) > (pValue1 + pValue2) && (dValue1 + dValue2) < 21)